使用 ActionMailer 向拥有帐户的所有用户发送电子邮件
我正在尝试使用 ActionMailer 向所有注册用户发送每日电子邮件。
调度部分很好,我只是不知道如何向每个用户发送电子邮件......可能有一个简单的解决方案,但这是一个非常漫长的一天。
非常感谢您的帮助。
I am trying to send a daily e-mail to all registered users using ActionMailer.
The scheduling part is fine, I just can't figure out how to send the e-mail to each user... There is probably a simple solution, but it has been a very long day.
Thanks a lot for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案非常简单:
说实话,如果您自己无法想到这个解决方案,我认为您应该在继续之前了解更多有关 Rails 的基础知识。
也就是说,您还应该记住,如果您的用户群变得很大,每天向每个用户发送电子邮件很快就会变得困难(您可能需要将负载分配到其他服务器),并且发送大量电子邮件到这种程度将导致您的 IP 和域有被标记为垃圾邮件的风险。如何避免这种情况并不简单,涉及数十种复杂的技术(SPF、DKIM、正确的 rDNS 记录、白名单服务等)。
我想说的是,如果您想将其扩展到许多用户,您需要需要了解的不仅仅是如何发送电子邮件。
The solution is very straightforward:
To be honest, if you couldn't think of this solution yourself, I think you should learn more about the basics of Rails before going any further.
That said, you should also keep in mind that if your user base becomes large, sending an email to each user every day can quickly become difficult (you may need to distribute the load to other servers) and sending mass emails to this extent will put your IPs and domains at risk of being flagged as spam. How to avoid this is not trivial and involves dozens of complex techniques (SPF, DKIM, correct rDNS records, whitelisting services, and so on.)
What I'm trying to say is that if you want to scale this to many users, you'll need to know a lot more than simply how to send out the emails.