Saim
Saim

Reputation: 2533

Rails: Amazon aws-ses, missing required header 'From'

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" "<[email protected]>")
    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)

Upvotes: 1

Views: 1397

Answers (1)

Saim
Saim

Reputation: 2533

Here is how it was fixed:

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

Upvotes: 2

Related Questions