简体   繁体   English

delay_job耙工作:工作rails 4不发送邮件

[英]delayed_job rake jobs:work rails 4 not sending mail

UserMailer with delay method not working in rails 4. As mentioned below, this code doesn't works 带有延迟方法的UserMailer在rails 4中不起作用。如下所述,此代码不起作用

def welcome_email
  UserMailer.delay.welcome_email(self)
end

But when I use below code it works fine. 但是,当我使用下面的代码时,它可以正常工作。

UserMailer.welcome_email(self).deliver

I have installed 2 gems, ie 我已经安装了2颗宝石,即

gem 'delayed_job'
gem 'delayed_job_active_record'

You need to pass ENV variables to your worker command. 您需要将ENV变量传递给worker命令。 Use this command in your command line: 在命令行中使用以下命令:

rake jobs:work RAILS_ENV=development VARIABLE_1='' VARIABLE_2=''

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

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