2011-12-28 56 views
1

來自Ruby代碼的電子郵件正在發送,沒有任何問題。但是,當我嘗試從Rails的控制檯發送,它給人的Missing required header 'From'錯誤甚至From在電子郵件(通知)規定,見下圖:Rails:Amazon aws-ses,缺少必需的標題'From'

def send_email(user) 
    recipients "#{user.email}" 
    from  %("Name" "<[email protected]>") 
    subject "Subject Line" 
    content_type "text/html" 
end 

下面是電子郵件從鐵軌控制檯發送代碼:

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:導軌(2.3.5),AWS-SES(0.4.4),郵件(2.3.0)

回答

2

這裏是它是如何固定的:

def send_email(user) 
    recipients "#{user.email}" 
    from  "'First Last' <[email protected]>" # changing the FROM format fixed it. 
    subject "Subject Line" 
    content_type "text/html" 
end 
相關問題