简体   繁体   English

作业延迟的Rails Action Mailer无法发送电子邮件

[英]Rails Action Mailer with delayed job not sending email

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. 当我不使用延迟的工作而仅使用.deliver时,它就可以正常工作。

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. 在我的控制台中,当我运行Delayed::Job.all我看到该作业已排队。 Then when I run rake jobs:work I see the job being executed successfully: 然后,当我运行rake jobs:work job rake jobs:work我看到该作业已成功执行:

[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? 我的猜测与延迟作业中未加载SMTP设置有关吗? Any help would be appreciated. 任何帮助,将不胜感激。 I'm using rails 4.0.13 and delayed job 4.0.2 我正在使用Rails 4.0.13和延迟的工作4.0.2

I figured out the problem. 我解决了这个问题。 My mailer action was blank. 我的邮件动作为空白。 D'oh! D'哦!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM