mirego/accent

Failure when sending email with SMTP

Closed this issue ยท 1 comments

jone commented

Hi there ๐Ÿ‘‹

I tried configuring accent to send emails through an SMTP server with STARTTLS on port 587.
I have configured correctly

SMTP_ADDRESS=smtp.hostname.tld
SMTP_PORT=587
MAILER_FROM=foo@domain.tld
SMTP_USERNAME=foo@domain.tld
SMTP_PASSWORD=XXXX

When I trigger an email by inviting somebody, the SMTP connection fails with:

โ”‚ 16:20:54.715 [error] Task #PID<0.4655.0> started from #PID<0.4654.0> terminating                                                                                                                        โ”‚
โ”‚ ** (ArgumentError) raise/1 and reraise/2 expect a module name, string or exception as the first argument, got: {:network_failure, ~c"smtp.hostname.tld", {:error, :closed}}                           โ”‚
โ”‚     (bamboo 2.2.0) lib/bamboo/strategies/task_supervisor_strategy.ex:25: anonymous fn/3 in Bamboo.TaskSupervisorStrategy.deliver_later/3                                                                โ”‚
โ”‚     (elixir 1.15.7) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2                                                                                                                            โ”‚
โ”‚ Function: #Function<0.95237244/0 in Bamboo.TaskSupervisorStrategy.deliver_later/3>                                                                                                                      โ”‚
โ”‚     Args: []                                                                                                                                                                                            โ”‚

On Port 587, there is a STARTTLS SMTP service running.
From another container in the same infrastructure the SMTP connection works and the mail is sent correctly with the exact same configuration settings.

How can I solve this problem?

This has been solved in the latest release with some magic TLS options in Bamboo adapter ๐Ÿ˜„