这是我的配置文件/config/initializers/setup_mail.rb
:
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "...something...",
:user_name => "my_gmail_name",
:password => "my_gmail_pass",
:authentication => "plain",
:enable_starttls_auto => true
}
这是Mailer's
我使用的方法类:
class Notifierpass < ActionMailer::Base
default from: "no-reply@my-domain.com"
def forgot_password(user)
@reset_password_link = reset_password_url(user.perishable_token)
mail(:from => "no-reply@my-domain.com", :to => user.email, :subject => "New passwordt")
end
end
发送电子邮件正在工作,我的问题是,在电子邮件的字段From始终是my_user_name而不是no-reply@my-domain.com。
哪里有问题?为什么仍然使用我的 gmail 名称?