Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Drops Mua in favour of the SMTP Swoosh adapter and adjusts the config accordingly. The lock file has also been cleaned up by running
mix deps.unlock --unused. Hopefully fixes #112. The new setup relies on:public_key.cacerts_get(), which assumes certificates are installed in the machine running the application.I've tested against three SMTP setups:
In all cases I have:
Aside from obviously setting transport to SMTP, I'm not sure these matter for the purpose of this PR. I did set up the from variable to a domain I own and verified with Resend and Postmark to rule out emails not being delivered because of that. In the following snippets I've commented out the environment variables whose default value is already suitable.
Resend
Resend works with the following variables:
It might also work with the 587 port and maybe setting SSL to false and TLS to always, to force StartTLS. The key addition vs before is using SMTP_SSL_SERVER to tell the underlying SSL/TLS implementation to accept a certificate that isn't for the exact relay host. This maybe was being done by Mua under-the-hood while it seems we need to set this explicitly when using the SMTP adapter which relies on
gen_smtp.Postmark
Postmark seems to work with the following variables:
I was not able to get Postmark to deliver my emails, but calling the Swoosh delivery function in IEx returned and
"ok queued <id>"tuple. I think I might need to add a credit card to Postmark, which I don't want to do, so I'm counting this as working.Mailpit
I got Mailpit to work locally with an unsecured connection with the following variables:
The key addition here is telling the underlying networking libraries not to try to resolve the relay host name with MX records, if I'm understanding this correctly.