No mail send with a Mailjet config on VPS


(Jonathan B) #1


First of all. Thanks very much for this great product :smile:

I try to configure a new Discourse instance on my OVH VPS in order to send mail with mailjet (or mandrill) but no mail send. I tried many things without success.

Any idea? Where can I find logs?

My config below:

  ## TODO: List of comma delimited emails that will be made admin and developer
  ## on initial signup example ','

  ## TODO: The domain name this Discourse instance will respond to

  ## TODO: The mailserver this Discourse instance will use
  DISCOURSE_SMTP_ADDRESS: "" # (mandatory)
  DISCOURSE_SMTP_PORT: 587 # (optional)
  DISCOURSE_SMTP_USER_NAME: "my-mailjet-api-key" # (optional)
  DISCOURSE_SMTP_PASSWORD: "my-mailjet-secret-key" # (optional, WARNING the char '#' in pw can cause problems!)
  #DISCOURSE_SMTP_ENABLE_START_TLS: true # (optional, default true)
  - exec: echo "Beginning of custom commands"

  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  - exec: rails r "SiteSetting.notification_email=''"
  ## After getting the first signup email, re-comment the line. It only needs to run once.

I successfully send mail using telnet:

root@vps197853:~# telnet 587
Connected to
Escape character is '^]'.
220 ESMTP Mailjet
auth login
334 VXNlcm5hbWU6
Mqsdfqsdfqsdfqsdfsdf= #(base64 of mailjet api key)
334 UGFzc3dvcmQ6
Msdsdfsdfsdfsdfsdfdsffdsdfsdfsdf= #(base64 of mailjet secret key)
235 2.7.0 Authentication successful
250 2.1.0 Ok
250 2.1.5 Ok
354 End data with <CR><LF>.<CR><LF>
Subject: Test Mailjet

250 2.0.0 Ok: queued as 823102E400AF
221 2.0.0 Bye

And the last command line after the ./launcher start app

+ /usr/bin/docker run -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=3 -e UNICORN_SIDEKIQS=1 -e RUBY_GC_MALLOC_LIMIT=40000000 -e RUBY_HEAP_MIN_SLOTS=800000 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e HOME=/root -e -e -e -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=my-mailjet-api-key -e DISCOURSE_SMTP_PASSWORD=my-mailjet-secret-key -h -e DOCKER_HOST_IP= --name app -t -p 80:80 -p 2222:22 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log local_discourse/app /sbin/boot

(David O'Dea) #2

I’m not to familiar with mail jet as I use Send Grid with my discourse instance but that shouldn’t matter.

  • if you force an email to be sent from discourse (sign up a test user etc) and when you check on yor mail jet dashboard, do any outbound emails show. If so are they being “dropped” ?

  • have you verified your SMTP settings on yourdiscourse/admin/email ?

(Héctor Fernández) #3

Did you try disabling TLS in the config? That would be a difference between your settings and the telnet test.

(Jonathan B) #4

Good point! I changed this line:

DISCOURSE_SMTP_ENABLE_START_TLS: false # (optional, default true)

and… it works!

Thanks very much.