Unable to send SMTP Alerts

Hi Team,

I am new to HA Proxy, I deployed HA Proxy as Docker container, I configured frontend and backend. I want to send smtp alerts when the backend down. here is the my haproxy.cfg

mailers smtp_servers
    mailer smtp1 smtp.office365.com:587
    timeout mail 5s
backend ng_service
    email-alert mailers smtp_servers
    email-alert level warning
    email-alert from devloped@company.com
    email-alert to devloped@company.com
    mode http

to check that I stoped backend services which was configured in haproxy.cfg
here is the error log

[WARNING]  (8) : Server ng_service/s1 is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT]    (8) : sendmsg()/writev() failed in logger #2: Connection refused (errno=111)
Server ng_service/s1 is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Server ng_service/s2 is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
backend ng_service has no server available!
[WARNING]  (8) : Server ng_service/s2 is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT]    (8) : backend 'ng_service' has no server available!

Any support ? and That emails have authentication How to pass authentication in haproxy.cfg file.

any support ?

What you are trying to do is not supported.

The email/mailers feature requires unauthenticated SMTP access, which office365 is not. Office365 will also require Starttls I think.

So you need to have a local mailserver that allows unauthenticated and plaintext SMTP from the haproxy box.

@lukastribus thanks for response, mail server have starttls. how to add that parameter starttls in haproxy config. the mail server required password. and how to pass that in config file. if am wrong guide me.

Please read my response carefully as I explained it already.

Thanks @lukastribus