寄件人/ development.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:adress => 'myemail@gmail.com',
:port => 25,
:authentication => :login,
:user_name => 'myemail',
:password => 'secret'
}
这是我的梅勒:
class UserMailer < ActionMailer::Base
def welcome_email(name, email, subject, question)
@recipients = email
@from = "myemail@gmail.com"
headers "Reply-to" => "myemail0@gmail.com"
@subject = "Welcome to MyDomain"
@sent_on = Time.now
@content_type = "text/html"
#body[:username] = name
mail(:to => email, :subject => subject, :from => 'myemail@gmail.com')
end
end
出现此错误: 504 5.3.3 AUTH机制LOGIN不可用
请帮忙, 提前谢谢。
答案 0 :(得分:1)
我使用这些内容来与gmail交谈
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:authentication => 'plain',
:user_name => 'myemail',
:password => 'secret',
:enable_starttls_auto => true,
:domain => 'gmail.com'
}