I've got a mailer class in Rails 3.2 that refuses to send mail, giving the following error:
Outgoing message to devs: #<Mail::Message:98270300, Multipart: false, Headers: <From: no-reply@example.com>, <To: dev@example.com>, <Subject: Error with script>, <Mime-Version: 1.0>, <Content-Type: text/html>>
rake aborted!
At least one recipient (To, Cc or Bcc) is required to send a message
... yet the to
field clearly has a recipient!
Here's my mailer class:
class Notifier < ActionMailer::Base
def send_mail_to_developer(error)
@error = error
mail to: "dev@example.com", subject: "Error with script"
end
end
Here's my rake task:
begin
task :import_bars
begin
Foo.import_foos
rescue => e
mail = Notifier.mail_current_developers(error)
puts "Outgoing message to devs: #{mail.inspect}"
mail.deliver!
end
end
end
This seems just so curly so I'm not sure what to do or why this error is occurring. Help?
Aucun commentaire:
Enregistrer un commentaire