来自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 console的电子邮件发送代码:
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)
答案 0 :(得分: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