Reputation: 2099
I opened a Google Apps account and registered email. I am trying to connect it to my Rials app running on Heroku with sidekiq. Letter opener works well on the development side so the setting is fine but sending emails with Google does not work.
This is config/initializers/mailer.rb
ActionMailer::Base.helper "application"
ActionMailer::Base.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: domain.com,
user_name: [email protected],
password: gmailpassword,
authentication: 'plain',
# authentication: 'login',
tls: true,
enable_starttls_auto: true
}
production.rb
config.action_mailer.default_url_options = { host: 'domainname.com' }
ActionMailer::Base.delivery_method = :smtp
In Google I turned off the 2 step Verification, I turned on the less secure apps etc but it is not working. Either it is showing Authenticate Error. During changing setting etc I experienced three errors:
SMTPAuthenticationError
Uncaught exception: 534-5.7.14
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=unknown state: unknown protocol
Any idea how to fix it and set up gmail correctly? Thank you
Upvotes: 1
Views: 2505
Reputation: 320
In addition to what was said here you also need to go to http://www.google.com/accounts/DisplayUnlockCaptcha while logged into the gmail account you're attempting to send through. I can confirm this worked for me on Heroku today.
Upvotes: 1
Reputation: 4427
Smtp setting in config/application.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:user_name => "[email protected]",
:password => "xxxxxx",
:authentication => "plain",
:enable_starttls_auto => true
}
visit your gmail settings and enable less secure apps to get the application working. link: google.com/settings/security/lesssecureapps
Upvotes: 0