Rails Action Mailer with delayed job not sending email

833 views Asked by At

So I'm trying to use delayed job with action mailer in my app and I've tested both locally and production and the email job is created and executed but the email is not being sent.

When I don't use delayed job and just use .deliver it works just fine.

The code for sending the email:

UserMailer.delay.followed_you(user)

In my console when I run Delayed::Job.all I see the job being enqueued. Then when I run rake jobs:work I see the job being executed successfully:

[Worker(host:f595047e-4de8-4247-8cdb-098774814694 pid:3)] Starting job worker
[Worker(host:f595047e-4de8-4247-8cdb-098774814694 pid:3)] Job Class#followed_you (id=10326) RUNNING
[Worker(host:f595047e-4de8-4247-8cdb-098774814694 pid:3)] Job Class#followed_you (id=10326) COMPLETED after 0.1035
[Worker(host:f595047e-4de8-4247-8cdb-098774814694 pid:3)] 1 jobs processed at 4.4194 j/s, 0 failed

But the email is never sent. My guess is it has to do with SMTP settings not being loaded in the delayed job? Any help would be appreciated. I'm using rails 4.0.13 and delayed job 4.0.2

1

There are 1 answers

0
Harry Jiang On

I figured out the problem. My mailer action was blank. D'oh!