Not sending Namecheap SMTP emails

I set up a Mastodon server on digital ocean and when going through the initial CLI wizard, it was able to successfully send the Test email through SMTP. However after that, it doesn’t send emails, even though it thinks it does in the log.

SMTP_SERVER=mail.privateemail.com
SMTP_PORT=587
SMTP_LOGIN=admin@mymastodonserver.com
SMTP_PASSWORD=<not shown>
SMTP_AUTH_METHOD=plain
SMTP_OPENSSL_VERIFY_MODE=none
SMTP_FROM_ADDRESS=Mastodon <notifications@mymastodonserver.com>

Here are some relevant logs:

journalctl -u mastodon-sidekiq | tail -f

Jan 17 05:12:09 mastodon-ubuntu bundle[2935]: 2021-01-17T05:12:09.857Z pid=2935 tid=gniti10a3 class=ActionMailer::DeliveryJob jid=6efe8354698845456eba1bda INFO: start
Jan 17 05:12:09 mastodon-ubuntu bundle[2935]: [ActiveJob] [ActionMailer::DeliveryJob] [52e5b037-1643-4f71-bf22-e7ad9cca5814] Performing ActionMailer::DeliveryJob (Job ID: 52e5b037-1643-4f71-bf22-e7ad9cca5814) from Sidekiq(mailers) with arguments: "UserMailer", "confirmation_instructions", "deliver_now", #<GlobalID:0x000055754933fce8 @uri=#<URI::GID gid://mastodon/User/3>>, "tzKjzvB8rjvFfTsCv-V3", {}
Jan 17 05:12:13 mastodon-ubuntu bundle[2935]: [ActiveJob] [ActionMailer::DeliveryJob] [52e5b037-1643-4f71-bf22-e7ad9cca5814] Sent mail to bob@bakeryinc.com (1099.5ms)
Jan 17 05:12:13 mastodon-ubuntu bundle[2935]: [ActiveJob] [ActionMailer::DeliveryJob] [52e5b037-1643-4f71-bf22-e7ad9cca5814] Performed ActionMailer::DeliveryJob (Job ID: 52e5b037-1643-4f71-bf22-e7ad9cca5814) from Sidekiq(mailers) in 3390.0ms
Jan 17 05:12:13 mastodon-ubuntu bundle[2935]: 2021-01-17T05:12:13.323Z pid=2935 tid=gniti10a3 class=ActionMailer::DeliveryJob jid=6efe8354698845456eba1bda elapsed=3.467 INFO: done

When I try to send manually using curl, it works:
# curl -n --ssl --mail-from "<notifications@mymastodonserver.com>" --mail-rcpt "<bob@bakeryinc.com>" --url smtp://mail.privateemail.com:587 -T mail.txt --user admin@mymastodonserver.com

What else can I look for to figure out why the emails are not getting sent?

That’s a tough one… actually everything went ok. No idea what is wrong.
Maybe you can try tcpdump on your server a sniff the traffic and see if anything is going out on TCP port 587?

1 Like

By the way this is not a good idea to have - change this after the things get to work.

1 Like

What should I change it to?

I should follow up that I have figured out my problem and it’s very lame: the emails were indeed getting sent but my client filtered them as spam.

1 Like