Can send email from command-line but not Discourse

email

(Robert Rossney) #1

tl;dr: I can send mail via SMTP from my droplet, but not from Discourse running on my droplet.

This works:

./swaks --auth --server smtp.mailgun.org --au postmaster@discourse.particleman.org --ap [redacted] --to rrossney@gmail.com --h-Subject: "Hello from Discourse"--body 'This is coming via SMTP.'

resulting in an entry in my mailgun log and well, I also receive the email. When I send the authorization email from discourse, the logs appear to indicate success:

Started PUT "/finish-installation/resend-email" for 198.27.215.254 at 2018-03-24 01:32:13 +0000
Processing by FinishInstallationController#resend_email as HTML
  Parameters: {"authenticity_token"=>[redacted]}
  Rendering finish_installation/resend_email.html.erb within layouts/finish_installation
  Rendered finish_installation/resend_email.html.erb within layouts/finish_installation (0.6ms)
  Rendered common/_special_font_face.html.erb (0.2ms)
  Rendered layouts/_head.html.erb (0.3ms)
Completed 200 OK in 27ms (Views: 2.6ms | ActiveRecord: 2.4ms)

and yet no email shows up in the mailgun logs, nor anywhere else. My app.yml contains:

  DISCOURSE_SMTP_ADDRESS: smtp.mailgun.com
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: postmaster@discourse.particleman.org
  DISCOURSE_SMTP_PASSWORD: [redacted]

…which seems straightforward enough. What have I overlooked?


Troubleshooting email on a new Discourse install
(Cameron:D) #2

Can you connect to mailgun on port 587, because swaks defaults to port 25/plaintext.

Try the telnet command in the guide above, or from a quick look though the swaks manual, try adding --tlsc --port 587 as parameters.


(Robert Rossney) #3

--tlsc requires the use of TLS, which I’m not at yet. Just using --port 587 works:

=== Trying smtp.mailgun.org:587...
=== Connected to smtp.mailgun.org.
<-  220 ak47 ESMTP ready
 -> EHLO discourse.particleman.org

So my machine can talk to mailgun using the SMTP address, port, user name, and password in my Discourse configuration, but Discourse can’t. Also, Discourse produces no information in its logs indicating that it thinks it failed. What could I possibly be doing wrong?


(Robert Rossney) #4

I wasn’t able to figure out what I’d done wrong, but I deleted the entire droplet and build a new one from scratch, and it works now.


(Joshua Rosenfeld) #5

This topic was automatically closed after 33 hours. New replies are no longer allowed.