Does anyone know how to setup gen_smtp to send email by O365


does anyone know how to setup gen_smtp to send email by O365 ( ) SMTP server.
It just sopped working with message:
{:retries_exceeded, {:temporary_failure, ~c"", :tls_failed}}}

when I try to send email.



1 Like

This might be relevant: TLS + SMTP Error when using OTP/26 #785 · Issue #328 · gen-smtp/gen_smtp · GitHub


Thx, it helped.

It always better to ask community, then try to google answer and had to go thorough all answers :wink:

I will say that this might not be necessarily a bug from OTP. I used to fetch emails with IMAP from the ms server and every 25% of requests would end in the similar errors.

Funny to see this here today as I’ve been trying to set SES with SMTP the whole day and kept receiving :tls_failed or :auth_failed all the time.
I saw that open issue but none of the workarounds presented there helped me.

If anyone has a working sample config for smtp and SES it would be much appreciated.

(for now we’re sending with Sendgrid for which we already have working code but we would like to move to SES because we’re receiving emails with it)

ex_aws_ses and send via api instead?

That would make things easier but we’re forwarding emails so we don’t want to touch anything on the incoming email.
SMTP would allow us to simply merge the received headers, body and maybe attachments.