为什么我的 Rails 应用程序尝试在开发环境中发送电子邮件?
我已按照此页面上的说明开始使用 ActionMailer。在我测试它可以从 Gmail 帐户发送电子邮件后,我将 Perform_deliveries 选项重置为 false 并发送了几封测试电子邮件。即使这些电子邮件不应该被发送,我可以查看 /var/log/mail.log 并看到它仍在尝试从 smtp 发送电子邮件,并且我不断收到弹出窗口警告我有关“操作超时”的信息,
这是示例错误:
postfix/smtp[2837]: connect to gmail-smtp-in.l.google.com[74.125.93.27]:25: Operation timed out
当我处于开发模式时,如何确保 Rails 不会尝试发送电子邮件?我认为这将是自动的,因为我已将 Perform_deliveries 设置为 false。
I have followed the instructions on this page to get started on ActionMailer. After I tested that it can send emails from a Gmail account, I reset perform_deliveries option to false and sent a few test emails. Even though these emails shouldn't get sent, I can look at the /var/log/mail.log and see that it's still trying to send emails from smtp, and I get constant popups warning me about "operation timed out"
Here is a sample error:
postfix/smtp[2837]: connect to gmail-smtp-in.l.google.com[74.125.93.27]:25: Operation timed out
How can I make sure that Rails doesn't attempt to send emails when I am in the development mode? I assumed this would be automatic since I have set perform_deliveries set to false.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试在
development.rb
文件中设置config.action_mailer.delivery_method = :test
。Try setting
config.action_mailer.delivery_method = :test
in yourdevelopment.rb
file.请检查您是否使用 ActionMailer #deliver 方法而不是 #deliver!因为最后一个绕过检查perform_deliveries
Please check if you using ActionMailer #deliver method and not #deliver! because last one bypass checking perform_deliveries