Setting up email in Mastodon using an external SMTP server

This is how I got Mastodon to use an external SMTP server to deliver outgoing mail.

I received lots of errors such as ”WARN: Net::SMTPFatalError: 550 Bad HELO – Host impersonating domain name []”, which resulted in zero emails being sent. I solved it by adding my server’s IP to a TXT record for my domain, looking something like,

v=spf1 a mx ip4: ~all

and then adding this to the .env.production file on my Mastodon server:

After reloading the Mastodon services it should work.

systemctl restart mastodon-sidekiq
systemctl reload mastodon-web


This setup worked for me. Might not work for you.

At first I thought SMTP_DOMAIN should be set to the same domain that the Mastodon instance is on (in my case, but that did not work. I instead had to set it to localhost, which resulted in all my emails coming through and not ending up in spam 🙂

1 reaktion på ”Setting up email in Mastodon using an external SMTP server”

Lämna en kommentar

Din e-postadress kommer inte publiceras. Obligatoriska fält är märkta *