开发者

Rails 3 mail with delay

开发者 https://www.devze.com 2023-04-01 13:14 出处:网络
I\'m continuing my migration from rails 2.3.12 to 3.0.9 and am now working sending email notifications through Gmail.

I'm continuing my migration from rails 2.3.12 to 3.0.9 and am now working sending email notifications through Gmail.

I followed the Railscast and I can now send emails properly in my rails 3.0 app when I do:

Mailer.test_html(email).deliver

But I can't figure out how to send them as a background task. In my rails 2.3 app, I used to use the delayed_job_mailer plugin to send emails as a background task. I now deleted the plugin. I also installed a newer version of the delayed_job gem (2.1.4). But, the

Mailer.delay.test_html(email)

command doesn't send the email on my development machine. In the logs, I can see the matching task being inserted in the delayed_jobs table. But I don't know when the task is being treated and deleted from the delayed_jobs table... and I don't receive any email.

In my development.rb fil开发者_JS百科e, I have:

config.action_mailer.perform_deliveries = true

config.action_mailer.raise_delivery_errors = true

but I'm not even sure if this is really useful. Any idea about what I'm missing?


You need to run the rake jobs:work task to have a process by Delayed Job work off jobs from that table. Without this, you will not receive any emails.

0

精彩评论

暂无评论...
验证码 换一张
取 消