Found it out: somehow my Mandrill key in heroku config was different from the one given in Mandrill's website and it wasn't showing errors. I configured wit the correct key and it works now.
Mandrill doesn't log errors, but the email is never sent
سؤال
I have a rails app that in which I built a contact form. It works locally with this configuration:
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: ENV["GMAIL_DOMAIN"],
authentication: "plain",
enable_starttls_auto: true,
user_name: ENV["GMAIL_USERNAME"],
password: ENV["GMAIL_PASSWORD"]
}
end
Now I want to make it run on Heroku using Mandrill, so this is my production.rb
config.action_mailer.smtp_settings = {
:address => "smtp.mandrillapp.com",
:port => 587,
:user_name => ENV["MANDRILL_USERNAME"],
:password => ENV["MANDRILL_APIKEY"]
}
# ActionMailer Config
config.action_mailer.default_url_options = { :host => 'myDomain.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = false
When I visit the website, fill the form and click "send", this is the log:
2014-04-07T23:35:56.661073+00:00 app[web.1]: Processing by ContatoController#create as HTML 2014-04-07T23:35:56.661073+00:00 app[web.1]: Parameters: {"utf8"=>"???", "auth enticity_token"=>"", "contato"=>{"name"=>"test1", "email"=>"myEmail@email.com", "message"=>"sdfsdffsd", "nickname"=>""}, "commit"=>"Send"} 2014-04-07T23:35:56.661073+00:00 app[web.1]: Parameters: {"utf8"=>"???", "auth enticity_token"=>"5769b554vJsVK3KldK/EmSaN8yUF/z4S7LZdzSlZ6XE=", "contato"=>{"name"=>"test1", "email"=>"myEmail@email.com", "message"=>"sdfsdffsd", "nicknam e"=>""}, "commit"=>"Send"} 2014-04-07T23:35:56.668905+00:00 app[web.1]: Rendered vendor/bundle/ruby/1.9.1 /gems/mail_form-1.5.0/lib/mail_form/views/mail_form/contact.erb (1.1ms) 2014-04-07T23:35:56.668905+00:00 app[web.1]: Rendered vendor/bundle/ruby/1.9.1 /gems/mail_form-1.5.0/lib/mail_form/views/mail_form/contact.erb (1.1ms) 2014-04-07T23:35:58.200457+00:00 app[web.1]: 2014-04-07T23:35:58.200457+00:00 app[web.1]: Sent mail to myEmail@gmail.com (153 0.1ms) 2014-04-07T23:35:58.200457+00:00 app[web.1]: 2014-04-07T23:35:58.200457+00:00 app[web.1]: Sent mail to myEmail@gmail.com (153 0.1ms) 2014-04-07T23:35:58.209656+00:00 heroku[router]: at=info method=POST path=/conta to host=myDomain.com request_id=b3b2f599-a685-4968-97a1-9dd7a3508083 fwd="20 1.37.139.250" dyno=web.1 connect=2ms service=1558ms status=200 bytes=6107
But the e-mail never comes. Mandril doesn't count as e-mail sent either.
Because I was using the informed e-mail as "from address", I changed to no-reply@myDomain.com and added it to mandrill's sending domain list. But still nothing happens.
What could be causing this error?
المحلول