Ruby Action Mailer:如何发送每日电子邮件?

发布于 2024-11-30 22:26:43 字数 144 浏览 0 评论 0原文

我只是想知道,在 Ruby on Rails 3 应用程序中,如果我想每天向用户发送一次电子邮件通知,而不是每次都发送通知,我该如何使用 Action Mailer 进行设置?

具体来说,是否有办法在每天下午 6:00 运行邮件程序?

谢谢!

I'm just wondering, in a Ruby on Rails 3 application, if I want to send users an email notification once per day, rather than with every notification, how would I set that up with Action Mailer?

Specifically, would there be a way to run a mailer at, say, 6:00pm every day?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风蛊 2024-12-07 22:26:43

一种选择是运行 cron 作业(Linux / Mac 服务器)。使用每当 gem 时这相当简单,它将 cron 作业语法的实际编写抽象为一组方便的 ruby​​ 方法,您可以通过编程方式更改这些方法。

这个 Railscast 很好地解决了这个问题。

One option is to run a cron job (Linux / Mac servers). This is fairly simple with the Whenever gem which abstracts the actual writing of cron job syntax into a convenient set of ruby methods, which you can programmatically change.

This Railscast goes over it pretty well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文