Debugging email problem and/or rebuilding discourse

(Kendall ) #1

Trying to obscure whatever discourse thinks is a link in this post so it will send:

I am new to rails and discourse. I’ve attempted to install discourse on digitialocean with docker per instructions, using mailjet as my mail server. My app.yml looks like:

 ## I'm hesitating to post the real domain name. 
 DISCOURSE_HOSTNAME: forum dot example dot com
 # ...
 DISCOURSE_DEVELOPER_EMAILS: 'example at example dot com'

  DISCOURSE_SMTP_ADDRESS: in-v3.mailjet dot com
  DISCOURSE_SMTP_USER_NAME: 4bccmedeedfeedmeedbeed3eed4ddd
  DISCOURSE_SMTP_PASSWORD: "ec9767abcdef0123456789abcdef0123"

After loading the registration page in my web browser, production.log ends with:

Started something "/finish-installation/confirm-email" for some IP at 2018-04-29 01:06:11 +0000
Processing by FinishInstallationController#confirm_email as HTML
  Rendering finish_installation/confirm_email.html.erb within layouts/finish_installation
  Rendered finish_installation/confirm_email.html.erb within layouts/finish_installation (9.6ms)
  Rendered common/_special_font_face.html.erb (0.6ms)
  Rendered layouts/_head.html.erb (1.5ms)
Completed 200 OK in 29ms (Views: 16.2ms | ActiveRecord: 0.0ms)

I haven’t seen a way to look at logs on mailjet, but it reports no email sent and I receive nothing.

If I use their mail API:

curl -s -X POST --user xyz:abc somewhere v3.1/send -H 'Content-Type: application/json' -d@/tmp/email.json

where xyz:abc is username and password and email.json is correct, I receive email. So, it’s not a problem with sending email,at least using mailjet’s v3.1 rest api.

Do you know how I can debug further?

Along another path, I’m trying to build discourse on windows 10 with linux subsystem and ubuntu for windows. I screwed up and created databases with techapj as the user instead of my user. Now I try to db:migrate again I get an error:

kshaw@DESKTOP-IJ5MU0E:~/discourse$ bundle exec rake db:migrate db:test:prepare db:seed_fu
Failed to report error: Invalid argument 2 Invalid argument subscribe failed, reconnecting in 1 second. Call stack ...

I could post more. But, how can I start over? I tried dropping the tables and cloning discourse again, but I seem to have caused some change somewhere that I am so far unable to undo. Advice?

(Kendall ) #2

I’ve used rake create:admin to create the user. In the admin / email section, it shows the emails as having been sent. There are no skipped entries or other entries. On mailjet the only mail that shows as having been received is the one I sent using curl from the command line. So… where else can I look for evidence?

(Jeff Atwood) #3

Did you follow the email troubleshooting #howto? I am not sure you did, since you didn’t indicate whether you tested to see if the email ports are open on your DO droplet.

(Kendall ) #4

I’ve now changed to use g suite for email, for unrelated reasons. I can connect using telnet, e.g.:

telnet 587
Connected to
Escape character is '^]'.
220 ESMTP 195-v6sm2474034itm.9 - gsmtp
EHLO luv at your service, []
250-SIZE 157286400
221 2.0.0 closing connection 195-v6sm2474034itm.9 - gsmtp
Connection closed by foreign host.

Does that mean the email ports are open?

I setup app.yml like this:

DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

Google doesn’t say what to use for user name and password and other posts on meta suggest leaving them blank.

production.log contains:

Sent mail to (490.0ms)
Completed 422 Unprocessable Entity in 3461ms (Views: 0.6ms | ActiveRecord: 4.9ms)

And no email arrives. Do you know what the problem might be, or how I can look further?

(Bhanu Sharma) #5

For username & password, You’re supposed to use the details of your sending account ( & password)
Also, You may be victimized of Google’s sending limits once they realize that You’re using g-suite for mass sending.

(Kendall ) #6

Another day is about to go by before I can look into this adequately. After adding my G-suite email address and password, the error is the same. I there a way to get more information than that sending didn’t work? production.log says:

Started POST "/admin/email/test" for 999.99.99.99 at 2018-05-02 15:28:09 +0000
Processing by Admin::EmailController#test as */*
  Parameters: {"email_address"=>""}
Sent mail to (671.5ms)
Completed 422 Unprocessable Entity in 5068ms (Views: 2.8ms | ActiveRecord: 37.1ms)

(Kendall ) #7

Like another person, I setup mailgun and it is now working without a problem. I suspect someones post about how discourse was send EHLO localhost.localdomain could be the problem. The G-Suite instructions say it automatically rejects any SMTP session that sends a bogus hostname like that.

Eventually, I will know enough to fix that, but I haven’t a clue so far. It would be nice to know how to change that, in case that is the problem with gmail.