From: Aurelien DARRAGON Date: Mon, 23 Sep 2024 10:05:18 +0000 (+0200) Subject: MEDIUM: mailers: warn about deprecated legacy mailers X-Git-Tag: v3.1-dev9~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d622f9d5b6c391fa650786a07c7d4eb23b3cd5b1;p=thirdparty%2Fhaproxy.git MEDIUM: mailers: warn about deprecated legacy mailers As mentioned in 2.8 announce on the mailing list [1] and on the wiki [2], use of legacy mailers is now deprecated and will not be supported anymore starting with version 3.3. Use of Lua script (AKA Lua mailers) is now encouraged (and fully supported since 2.8) for this purpose, as it offers more flexibility (e.g: alerts can be customized) and is more future-proof. Configurations relying on legacy mailers will now raise a warning. Users willing to keep their existing mailers config in a working state should simply add the following line to their global section: # mailers.lua file as provided in the git repository # adjust path as needed lua-load examples/lua/mailers.lua [1]: https://www.mail-archive.com/haproxy@formilux.org/msg43600.html [2]: https://github.com/haproxy/wiki/wiki/Breaking-changes --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 5054e98279..966bfbad02 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -4600,7 +4600,8 @@ table type {ip | integer | string [len ] | binary [len Creates a new mailer list with the name . It is an @@ -4610,6 +4611,11 @@ mailer : Defines a mailer inside a mailers section. Example: + global + # mailers.lua file as provided in the git repository + # adjust path as needed + lua-load examples/lua/mailers.lua + mailers mymailers mailer smtp1 192.168.0.1:587 mailer smtp2 192.168.0.2:587 diff --git a/src/mailers.c b/src/mailers.c index 905bb6745a..50f1e76d3b 100644 --- a/src/mailers.c +++ b/src/mailers.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -113,6 +113,10 @@ int init_email_alert(struct mailers *mls, struct proxy *p, char **err) const char *err_str; int i = 0; + if (!send_email_disabled) + ha_warning("Legacy mailers used by %s '%s' will not be supported anymore in version 3.3. You should use Lua to send email-alerts, see 'examples/lua/mailers.lua' file.\n", + proxy_type_str(p), p->id); + if ((queues = calloc(mls->count, sizeof(*queues))) == NULL) { memprintf(err, "out of memory while allocating mailer alerts queues"); goto fail_no_queue;