No mail send with a Mailjet config on VPS

email
docker

(Jonathan B) #1

Hi.

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:

env:
  ## TODO: List of comma delimited emails that will be made admin and developer
  ## on initial signup example 'user1@example.com,user2@example.com'
  DISCOURSE_DEVELOPER_EMAILS: "bmxperience@gmail.com"

  ## TODO: The domain name this Discourse instance will respond to
  DISCOURSE_HOSTNAME: "discourse.bmxperience.com"

  ## TODO: The mailserver this Discourse instance will use
  DISCOURSE_SMTP_ADDRESS: "in-v3.mailjet.com" # (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)
.
.
.
run:
  - 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='forum@bmxperience.com'"
  ## 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 in-v3.mailjet.com 587
Trying 46.105.54.204...
Connected to in.mailjet.com.
Escape character is '^]'.
220 leela-8.mailjet.com 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
MAIL FROM:forum@bmxperience.com
250 2.1.0 Ok
RCPT TO:bmxperience@gmail.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
To:bmxperience@gmail.com
From:forum@bmxperience.com
Subject: Test Mailjet

Yeah!
.
250 2.0.0 Ok: queued as 823102E400AF
quit
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 DISCOURSE_DEVELOPER_EMAILS=bmxperience@gmail.com -e DISCOURSE_HOSTNAME=discourse.bmxperience.com -e DISCOURSE_SMTP_ADDRESS=in-v3.mailjet.com -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=my-mailjet-api-key -e DISCOURSE_SMTP_PASSWORD=my-mailjet-secret-key -h vps221296.ovh.net-app -e DOCKER_HOST_IP=172.17.0.1 --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
dbf7ef50186eaf105208e9d5984f706f0d2c0ea5c23fbe22ef787f624f8f2547

(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.