简体   繁体   中英

Sending Mail in Rails App Heroku

I have Users that are able to invite others by email to a project they are working on but I keep getting the following error-

Net::SMTPAuthenticationError 

Here is how I have mail settings configured for my production environment

  config.action_mailer.default_url_options = { :host => 'myapp.herokuapp.com' }

  #Sending email on the production side
  config.action_mailer.smtp_settings = {
    :enable_starttls_auto => true,
    :address => "smtp.gmail.com",
    :port => "587",
    :domain => "gmail.com",
    :authentication => :plain,
    :user_name => "example@gmail.com",
    :password => "password"
  }

It works in my local environment using sqlite3 as I expect but when I push to heroku it throws the above error after running heroku logs. I believe my config settings to be correct and obviously heroku uses postgresql, so what am I missing here?

Thanks for you r attention.

I found the reason here How to send confirmation e-mails using gmail smtp service for registration using devise under development mode locally?

Google had detected some "suspicious" activity on the newly created account and was blocking me from sending emails. After verifying the account I was able to send emails with the above config and switching :domain => "heroku.com"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM