我正在尝试使用 Rails 3 中内置的 :mail 函数发送邮件,如下所示:
default from: "Me <me@myname.mailgun.org>"
def gift
mail :to => "myname@gmail.com", :subject => "test"
end
然后我有一个名为 setup_mail.rb 的文件config/initializers
:
ActionMailer::Base.smtp_settings = {
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_charset = "utf-8"
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
:authentication => :plain,
:address => "smtp.mailgun.org",
:port => 587,
:domain => "myname.mailgun.org",
:user_name => "postmaster@myname.mailgun.org",
:password => "mypass"
}
}
我添加了该代码,然后重新启动了我的服务器,但应用程序无限期加载。