0

I'm trying to use Delayed_job to send mails asynchronously from my rails 3.1 app.

I followed the instructions on the github page but my mails aren't being sent (they were before i tried using this gem). I see they are being put on the jobs table, and they're being consumed, but the bundle exec rake jobs:work -v task doesn't give any output.

This is the code in my controller:

Notifier.delay.project_deleted(@project, current_user, u.email )

and the code in my mailer

def project_deleted(project, admin, destination)
  @project = project
  @admin = admin

  mail to: destination
end

EDIT: I'm also doing this on windows, and a sqlite3 db, if it matters.

EDIT2: Also, something weird: If i add .deliver, which i know i shouldn't, the task gets executed and the mails are sent; ALTHOUGH, the controller responds with this: ` undefined method deliver' for #

dcastro
  • 66,540
  • 21
  • 145
  • 155

1 Answers1

0

I'm not sure what Notifier.delay.project_deleted(@project, current_user, u.email ) does but.

Here is what I would do to determine the issue. First get Hoptoad configured. Then =>

def project_deleted(project, admin, destination)
  @project = project
  @admin = admin

  mail to: destination
rescue Exception => e
  # send error to hoptoad
     HoptoadNotifier.notify(
        :error_class   => "Unable to Send Mail",
        :error_message => "Unable to send mail. ERROR: #{e.message}"
      )
end
drhenner
  • 2,200
  • 18
  • 23