I want to send email via my gmail account in PRODUCTION. It works great in local host.
In my environment.rb I have :
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "myhost.com",
:authentication => "plain",
:user_name => "[email protected]",
:password => "mypassword",
:enable_starttls_auto => true
}
And in my production.rb file :
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = { :host => 'gmail.com' }
But it doesn't work and I have that error :
Errno::ECONNREFUSED (Connection refused - connect(2)):
Any ideas ? My app is deployed on Heroku.
For the host
what do I have to put ?
Thanks !
Host should be www.yourapp.com
. My settings for gmail on Heroku look like this, and they work:
config.action_mailer.default_url_options = { :host => 'www.myapp.com' }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:authentication => :login,
:user_name => "[email protected]",
:password => "mypassword"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With