Вопрос

Email from Ruby code is sending without any issue. But when I try to send it from Rails console, it gives the Missing required header 'From' error even From is specified in the email (Notifier), see below:

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

Here is email sending code from 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

Am I missing something?

GEMS used: rails (2.3.5), aws-ses (0.4.4), mail (2.3.0)

Это было полезно?

Решение

Here is how it was fixed:

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
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top