Hi,
I have a working Discourse app, minus the email. I've tried to follow a previous question, the bitnami wiki, the github doc, and the mandril Postfix setup guide but I'm still getting no joy :(
So here are my steps so far in the hope we can diagnose it and help anybody else with the same problem.
It's discourse 0.9.4, launched from Bitnami with a Public DNS http://new-server-XXXXXX.bitnamiapp.com (where XXXXXX has some alphanumeric value).
to disable the gmail smtp account I commented out these lines in <installdir>/apps/discourse/htdocs/config/environment/production.rb
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# config.action_mailer.delivery_method = :smtp
# config.action_mailer.smtp_settings = {
# :address => "smtp.gmail.com",
# :port => 587,
# :domain => 'gmail.com',
# :user_name => 'myuser@gmail.com',
# :password => 'mysecretpwd',
# :authentication => 'plain',
# :enable_starttls_auto => true }
below that, I uncommented and modified the file as:
# you may use other configuration here for mail eg: sendgrid
config.action_mailer.delivery_method = :sendmail
config.action_mailer.smtp_settings = {
:address => "smtp.mandrillapp.com",
:port => 25, # ports 587 and 2525 are also supported with STARTTLS
:enable_starttls_auto => true, # detects and uses STARTTLS
:user_name => "myemail@somedomain.com",
:password => "XXXXXXXXX-XXXXX", # SMTP password is any valid API key
:authentication => 'login', # Mandrill supports 'plain' or 'login'
:domain => 'mydiscoursedomain.com', # your domain to identify your server when connecting
}
# config.action_mailer.delivery_method = :sendmail
config.action_mailer.sendmail_settings = {arguments: '-i'}
then following the mandril postfix tutorial, I sudo apt-get install
-ed postfix, libsasl2-modules, and
$ hostname -f
showed an expected ip-172-31-XX-XXX
(last numbers obscured for security here).
Ok, so I created an /etc/postfix/sasl/sasl_pwd
with a single line
[smtp.mandrillapp.com] USERNAME:XXXXXXXXX-XXXXX
sudo chmod 600
the file and then
$ sudo postmap /etc/postfix/sasl/sasl_pwd
Then, modified /etc/postfix/main.cf
adding the required lines
# enable SASL authentication
smtp_sasl_auth_enable = yes
# tell Postfix where the credentials are stored
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_pwd
smtp_sasl_security_options = noanonymous
# use STARTTLS for encryption
smtp_use_tls = yes
relayhost = [smtp.mandrillapp.com]
and left the rest as it was, including
mydestination = ip-172-31-XX-XXX, localhost.localdomain, localhost
In my case all email goes through mandrill, so I just sudo postfix reload
and test it:
$ sendmail personalemail@gmail.com
From: hello@mydiscoursedomain.com
test
.
which results in
Jul 10 14:34:18 ip-172-31-XX-XXX postfix/qmgr[17657]: 7CBE328E1D: from=<bitnami@ip-172-31-XX-XXX>, size=254, nrcpt=1 (queue active)
Jul 10 14:34:18 ip-172-31-XX-XXX postfix/smtp[17699]: 7CBE328E1D: to=<personalemail@gmail.com>, relay=smtp.mandrillapp.com[54.245.XX.XXX]:25, delay=40, delays=40/0.04/0.19/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 642193A0093)
Jul 10 14:34:18 ip-172-31-XX-XXX postfix/qmgr[17657]: 7CBE328E1D: removed
But that email never arrives and there is no outboud
activity in the Mandrill dashboard either. And sending a test email from discourse:
also doesn't do anything. Any tips or suggestions on where I might have gone wrong are appreciated. (obviously I restarted postfix, apache ... and I'm not sure what else to restart!)
Thank you
=== EDIT === I tried to look into the redis log as suggested:
2013-07-11T12:20:27Z 1140 TID-adw7s WARN: {"retry"=>true, "queue"=>"default",
"class"=>"Jobs::TestEmail", "args"=>[{"to_address"=>",mypersonalemail@gmail.com",
"current_site_id"=>"default"}], "jid"=>"0cc8aa94aa8fb1ef47cd1d7c",
"enqueued_at"=>1373545226.7297878,
"error_message"=>"535-5.7.8 Username and Password not accepted. Learn more at\\n",
error_class"=>"Net::SMTPAuthenticationError", "failed_at"=>"2013-07-11T11:35:48Z",
"retry_count"=>7, "retried_at"=>2013-07-11 12:20:27 UTC}
013-07-11T12:20:27Z 1140 TID-adw7s WARN: 535-5.7.8 Username and Password not accepted. Learn more at