Email sends but isn't received

(Battlesnake) #1

I have configured email:



I rebuilt the container, and the settings in the admin panel (/admin/email) match.

I enter an address to send a test email to, hit “Send Test Email” and see “Sent!”. But the email never arrives (either in Inbox or Spam).

I’ve tested with swaks:

swaks -s -p 2525 --ehlo -au -ap not_password -a PLAIN --tls --tls-verify -t -f --body "From $(hostname)"

  1. When run from my laptop, the email arrives within seconds.

  2. When run from the cloud server, the email arrives within seconds.

  3. When run from within the Discourse Docker container, the email arrives within seconds.

  4. But when I send a test email via Discourse, it doesn’t arrive. Nobody is receiving emails from the Discourse site.

For (4), here is a tail of shared/standalone/log/rails/production.log:

Started POST "/admin/email/test" for at 2016-09-29 13:41:39 +0000
Processing by Admin::EmailController#test as */*
  Parameters: {"email_address"=>""}

Sent mail to (378.0ms)
  Rendered text template (0.1ms)
Completed 200 OK in 535ms (Views: 1.8ms | ActiveRecord: 4.9ms)

I should add that the hostname set in the docker container does not match DISCOURSE_HOSTNAME. It is instead *-discourse, where * is the first subdomain of the full hostname name of the host machine. With TCPDUMP, I found that the EHLO command has the wrong local host name (although I doubt that this matters): EHLO localhost.localdomain

I have also reviewed the suggestions at Troubleshooting email on a new Discourse install

Info for current configuration:

(Battlesnake) #2


After posting, I had a look in some of the other tabs, and under "Skipped", I found:
[Sender] 554 5.7.1 <>: Recipient address 
rejected: Username and sender doesnt match

I edited the notification email address in Discourse settings, and email appears to work now. Discourse was reporting that the email was sent, but it wasn’t sent successfully. I couldn’t see this from the TCPDUMP as the error message was presumably coming in via TLS and I hadn’t bothered decrypting SMTP response packets since Discourse was telling me that it was sending successfully.

(Régis Hanol) #3