Authentication emails are not going out, but other notification emails are

Other emails are sent but only authentication emails are not sent.

Here is my .env.production

DB_HOST=/var/run/postgresql
DB_PORT=5432
DB_NAME=mastodon_production
DB_USER=mastodon
DB_PASS=
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
# Mail settings
SMTP_SERVER=smtp.mailgun.org
SMTP_PORT=587
SMTP_LOGIN=postmaster@address.mailgun.org
SMTP_PASSWORD=mypasswordhere
#SMTP_OPENSSL_VERIFY_MODE=none
#SMTP_FROM_ADDRESS='Mastodon <notifications@mst.canor.kr>'
# Full Text Search
ES_ENABLED=true
ES_HOST=localhost
ES_PORT=9200

and here is the part that’s keep showing in sudo journalctl -u mastodon-sidekiq | grep -i smtp

Aug 13 21:05:57 canors_ubuntu bundle[32572]: /home/mastodon/.rbenv/versions/2.6.6/lib/ruby/2.6.0/net/smtp.rb:934:in `block in getok'
Aug 13 21:05:57 canors_ubuntu bundle[32572]: /home/mastodon/.rbenv/versions/2.6.6/lib/ruby/2.6.0/net/smtp.rb:960:in `critical'
Aug 13 21:05:57 canors_ubuntu bundle[32572]: /home/mastodon/.rbenv/versions/2.6.6/lib/ruby/2.6.0/net/smtp.rb:933:in `getok'
Aug 13 21:05:57 canors_ubuntu bundle[32572]: /home/mastodon/.rbenv/versions/2.6.6/lib/ruby/2.6.0/net/smtp.rb:919:in `quit'
Aug 13 21:05:57 canors_ubuntu bundle[32572]: /home/mastodon/.rbenv/versions/2.6.6/lib/ruby/2.6.0/net/smtp.rb:612:in `do_finish'
Aug 13 21:05:57 canors_ubuntu bundle[32572]: /home/mastodon/.rbenv/versions/2.6.6/lib/ruby/2.6.0/net/smtp.rb:521:in `ensure in start'
Aug 13 21:05:57 canors_ubuntu bundle[32572]: /home/mastodon/.rbenv/versions/2.6.6/lib/ruby/2.6.0/net/smtp.rb:521:in `start'
Aug 13 21:05:57 canors_ubuntu bundle[32572]: /home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:109:in `start_smtp_session'
Aug 13 21:05:57 canors_ubuntu bundle[32572]: /home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:100:in `deliver!'
Aug 13 21:05:57 canors_ubuntu bundle[32572]: 2020-08-13T12:05:57.154Z pid=32572 tid=orpkz9jkg WARN: {"context":"Job raised exception","job":{"retry":true,"queue":"mailers","class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","wrapped":"ActionMailer::DeliveryJob","args":[{"job_class":"ActionMailer::DeliveryJob","job_id":"30e0bdec-a9f3-47d4-bcbe-d265bda97f45","provider_job_id":null,"queue_name":"mailers","priority":null,"arguments":["UserMailer","confirmation_instructions","deliver_now",{"_aj_globalid":"gid://mastodon/User/5"},"briYmyaj7xYjhkzVPXoL",{"_aj_symbol_keys":[]}],"executions":0,"locale":"ko"}],"jid":"7db615fe97ea25ce4eb5ca14","created_at":1597310737.7808456,"enqueued_at":1597320354.616732,"error_message":"502 Command not implemented\n","error_class":"Net::SMTPSyntaxError","failed_at":1597310740.2701125,"retry_count":8,"retried_at":1597316069.9464197},"jobstr":"{\"retry\":true,\"queue\":\"mailers\",\"class\":\"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper\",\"wrapped\":\"ActionMailer::DeliveryJob\",\"args\":[{\"job_class\":\"ActionMailer::DeliveryJob\",\"job_id\":\"30e0bdec-a9f3-47d4-bcbe-d265bda97f45\",\"provider_job_id\":null,\"queue_name\":\"mailers\",\"priority\":null,\"arguments\":[\"UserMailer\",\"confirmation_instructions\",\"deliver_now\",{\"_aj_globalid\":\"gid://mastodon/User/5\"},\"briYmyaj7xYjhkzVPXoL\",{\"_aj_symbol_keys\":[]}],\"executions\":0,\"locale\":\"ko\"}],\"jid\":\"7db615fe97ea25ce4eb5ca14\",\"created_at\":1597310737.7808456,\"enqueued_at\":1597320354.616732,\"error_message\":\"502 Command not implemented\\n\",\"error_class\":\"Net::SMTPSyntaxError\",\"failed_at\":1597310740.2701125,\"retry_count\":8,\"retried_at\":1597316069.9464197}"}

What is your SSL/TLS setting?
Is postmaster@address.mailgun.org the literal value?
I suspect either SSL setup or authentication failed

thank you @saper

What is your SSL/TLS setting?

I don’t remember doing anything with SSL/TLS setting except nginx part

Is postmaster@address.mailgun.org the literal value?

no… the address part is a long string of characters starting with sandbox

I suspect either SSL setup or authentication failed

but if that’s the case shouldn’t other mails (ie follows, boosts, etc) not sent too?

Maybe you have hit some Mailgun Sandbox limitation?

1 Like

ugh… this looks suspicious

With sandbox domains, you can only send emails to up to five authorized recipients. Even if you’re using a test mode (more on this below) and not delivering any emails, you’ll need to get the authorization from each individual recipient.

I think I got the source of the problem thanks!