Setting up a Mastodon instance was not so hard. I mean, it took some tries to get it right finally, but generally I could understand what is happening and why there is currently a problem all the time during that process.

However, configuring that instance to send emails was a frustrating experience for me, mainly due to fact that I could not find a reliable source of error messages. In Mastodon, v3.4.1 at the time of writing, the emails are pushed into sidekiq queues. It's interface is quite polished, but the error messages did not show up for me, no matter how hard I clicked around. Having no previous experience with sidekiq, I decided look elsewhere.

Looking for a solution

Search results of about 30 pages shown different SMTP configurations, but not a single one would enable sending emails from Mastodon instance to my inbox. Looking into sidekiq, the problem of not sending emails was shown there by precisely two scenarios, neither particularly helpful:

  1. The Processed jobs counter incremented, thinking that email was sent
  2. The job got oscillating between Busy and Retries, knowing there was a problem sending an email

Again, no emails were sent whatsoever. At the time I started becoming too desperate, I came up with this combination of configuration options:

SMTP_SERVER=smtp.example.com
SMTP_PORT=465
SMTP_LOGIN=mastodon@peterbabic.dev
SMTP_PASSWORD=very-strong-passphrase-here
SMTP_FROM_ADDRESS=mastodon@peterbabic.dev
SMTP_SSL=true
SMTP_ENABLE_STARTTLS_AUTO=false
SMTP_AUTH_METHOD=plain
SMTP_OPENSSL_VERIFY_MODE=none
SMTP_DELIVERY_METHOD=smtp

This particular configuration could be used with other mail servers that send emails using port 465 using SSL. Most of mail servers I am used to work specifically like this, so I am not entirely sure why I could not find this anywhere else, but maybe it is a localized problem.