530-5.5.1需要验证。了解更多信息

时间:2014-12-12 05:34:43

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

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需要验证。在`

了解更多信息

1 个答案:

答案 0 :(得分: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 => 'none'

跳过ssl错误的部分