1

来自 Ruby 代码的电子邮件正在发送,没有任何问题。但是当我尝试从 Rails 控制台发送它时,它甚至在电子邮件(通知程序)中指定了Missing required header 'From'错误,见下文:From

def send_email(user)
    recipients "#{user.email}"
    from       %("Name" "<name@domain.com>")
    subject   "Subject Line"
    content_type "text/html"
end

这是从 rails 控制台发送电子邮件的代码:

ActionMailer::Base.delivery_method = :amazon_ses
ActionMailer::Base.custom_amazon_ses_mailer = AWS::SES::Base.new(:secret_access_key => 'abc', :access_key_id => '123')
Notifier.deliver_send_email

我错过了什么吗?

使用的 GEMS:rails (2.3.5)、aws-ses (0.4.4)、mail (2.3.0)

4

1 回答 1

2

以下是它的修复方法:

def send_email(user)
    recipients "#{user.email}"
    from       "'First Last' <name@domain.com>"   # changing the FROM format fixed it.
    subject   "Subject Line"
    content_type "text/html"
end
于 2011-12-29T11:28:00.427 回答