我遵循了在Rails中发送电子邮件的教程,我在我的production.rb
中有这个 ActionMailer::Base.smtp_settings = {
:tls => true,
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'http://myapp.heroku.com',
:authentication => :plain,
:user_name => 'mygmailusername@gmail.com',
:password => 'mypassword'
}
这个Actionmailer
mail(
:to => user.email,
:from => "noreply@myapp.heroku.com",
:subject => "Welcome to My App",
:body => "Please activate your account by going to this address: \n" +
"http://myapp.heroku.com/" +
user.username + "/activate/" + user.activation_key
)
发送电子邮件时,电子邮件来自mygmailusername@gmail.com,而不是来自noreply@myapp.heroku.com。我该如何解决这个问题?
答案 0 :(得分:0)
你不能,GMail会让你像其他人一样发送邮件(原因很明显)。