Gmail on heroku with Rails 3

后端 未结 5 795
不知归路
不知归路 2021-01-11 16:08

I am trying to send emails from Heroku up and running. At the moment I can send emails from Heroku via the \"tutorial\" at http://blog.heroku.com/archives/2009/11/9/tech_sen

相关标签:
5条回答
  • 2021-01-11 16:08

    I have personally encountered that error sending with Gmail and needed to solve an unlock CAPTCHA to allow the sending. Gmail can be picky with security sometimes, and the documentation is not very apparent.

    The full message should read:

    530-5.5.1 Authentication Required. Learn more at https://support.google.com/mail/bin/answer.py?hl=en&answer=14257
    

    so check out that link and follow the directions there.

    You might need to sign into the Gmail webapp or (what I had to do), solve the unlock CAPTCHA. Or perhaps it is something in your app or environment, but following the Google directions is worth a shot.

    0 讨论(0)
  • 2021-01-11 16:09

    Just do as the above user has said about the SMTP settings.
    In addition to that, Gmail blocks unidentified logins from a application to your account without you verifying it.
    So go to your Gmail client and log in there.

    If that doesn't work go to unlock captcha

    0 讨论(0)
  • 2021-01-11 16:11

    I have mail being sent via Gmail on a heroku app. Here is my config if it helps. I am not using any third party plugins, just Rails 3.

    In config/initializers/setup_mail.rb

    ActionMailer::Base.smtp_settings = {
      :address  => "smtp.gmail.com",
      :port  => 587,
      :user_name  => "foo@bar.com",
      :password  => "foobar",
      :authentication  => :plain,
      :enable_starttls_auto => true
    }
    

    In config/environments/production.rb

    After the end statement for the config block, I have added

    ActionMailer::Base.smtp_settings[:enable_starttls_auto] = false

    0 讨论(0)
  • 2021-01-11 16:14

    Please add the following code in config/environments/development.rb

    config.action_mailer.raise_delivery_errors = false
    config.action_mailer.delivery_method = :smtp
    config.action_mailer.perform_deliveries = true
    

    and also make sure you have added the following in config/initializers/smtp_gmail.rb

    ActionMailer::Base.smtp_settings = {
      :address              => "smtp.gmail.com",
      :port                 => 587,
      :user_name            => "abc@xyz.com",
      :password             => "password",
      :authentication       => "plain",
      :enable_starttls_auto => true
    }
    
    0 讨论(0)
  • 2021-01-11 16:20

    Did you export those environment variables on your local machine? You say you're adding the GMAIL_SMTP... to heroko config, but are you:

    $ export GMAIL_SMTP_USER=username@gmail.com $ export GMAIL_SMTP_PASSWORD=yourpassword

    I ran into your question because I also have email working in dev, and wondered if the 2009 post about how to get smtp & gmail to work on heroku is still necessary. Apparently so.

    0 讨论(0)
提交回复
热议问题