mailers section lists message transfer agent (MTA) servers to which HAProxy Enterprise will forward error messages so that they can be distributed to email recipients. Emails are sent using the SMTP protocol.
mailers keyword is followed by a label, such as smtp_servers, to differentiate it from others. The label can be used by frontend, backend, and listen sections.
mailers smtp_servers mailer smtp1 192.168.1.10:587
Mailers configuration example
In the following example we have defined a mailers section called smtp_servers that lists two mail servers where error messages will be sent.
The defaults section uses the
email-alert mailers directive to define which mailers section will be used to send error messages to.
Messages go out to each mailer in the list. In a
frontend section, configure:
mailerssection to use,
the from address and the to address,
the Syslog level of events to trigger the alert:
defaults mode http log global option httplog timeout connect 10s timeout client 1m timeout server 1m mailers smtp_servers mailer smtp1 192.168.1.10:587 mailer smtp2 192.168.1.11:587 defaults mode http log global option httplog timeout connect 10s timeout client 1m timeout server 1m # email settings email-alert mailers smtp_servers email-alert from email@example.com email-alert to firstname.lastname@example.org email-alert level info
email-alert directive can be used in defaults, frontends, backends and listen sections. The detail of the error messages sent are defined by
email-alert level <level> and the level can be any of the 8 syslog levels: