如何配置Rails禁止在分期中发送真正的电子邮件? [英] How do I configure Rails to disable sending real emails out while in staging?

查看:128
本文介绍了如何配置Rails禁止在分期中发送真正的电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Heroku上,电子邮件不会在开发过程中发送出去,而是正在正式发送。我希望在Heroku上运行一个单独的临时实例,但不希望邮件发送出去(只是发送到日志)。

test.rb中的这一行告诉ActionMailer不要发送邮件:

  config.action_mailer.delivery_method =:test 

相反,它们会累积在ActionMailer :: Base.deliveries数组中。



您需要为应用程序设置临时环境,并将Heroku配置为在临时实例上使用该环境。


I'm on Heroku, and emails don't get sent out in development, but are properly being sent in production. I'd like to run a seperate staging instance on Heroku, but don't want emails being sent out (just to a log).

解决方案

This line in test.rb tells ActionMailer not to deliver emails:

config.action_mailer.delivery_method = :test

Instead, they are accumulated in the ActionMailer::Base.deliveries array.

You'll need to set up a staging environment for your application and configure Heroku to use that environment on your staging instance.

这篇关于如何配置Rails禁止在分期中发送真正的电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆