【问题标题】:530-5.5.1 Authentication Required. Learn more at530-5.5.1 需要验证。了解更多信息
【发布时间】:2016-08-18 21:03:37
【问题描述】:

在order_mailer.rb:

default from: 'notifications@example.com'

def welcome_email(order)
 @user = "Uday kumar das"
 @url  = 'http://example.com/login'
 mail(to: 'dasudaykumar017@gmail.com', subject: 'Welcome to My Awesome Site')
end

在orders_conroller:

def delivery
 @order1 = Order.where(:orderId=>params[:orderId])
 @order = Order.find(@order1)
 OrderMailer.welcome_email(@order).deliver
end

在environments/development.rb:

config.action_mailer.raise_delivery_errors = true

config.action_mailer.delivery_method = :smtp

我是 Rails 邮件的新手。我指的是 http://guides.rubyonrails.org/action_mailer_basics.html 来学习。我收到如下错误:

OrdersController#delivery 中的 Net::SMTPAuthenticationError

530-5.5.1 需要身份验证。了解更多`

【问题讨论】:

标签: ruby-on-rails ruby-on-rails-4


【解决方案1】:

我用我的gmail做了同样的事情,以下是我的配置,试试看是否可行

config.action_mailer.default_url_options = { :host => 'localhost:3000' }

ActionMailer::Base.smtp_settings = {

                :address        => "smtp.gmail.com",
                :port           => 587,
                :authentication => :plain,
                :user_name      => "<my gmail>@gmail.com",
                :password       => "<my gmail password>",
                :openssl_verify_mode  => 'none' }

请注意:

:openssl_verify_mode =&gt; 'none'

跳过 ssl 错误的部分

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-05
    • 1970-01-01
    • 2014-01-13
    • 2017-09-17
    • 1970-01-01
    • 1970-01-01
    • 2020-08-19
    • 2012-07-28
    相关资源
    最近更新 更多