[英]Development and production configurations for Rails mailer
For deliverability reasons, I installed SPF records and other types of authentication to make sure production emails aren't flagged as spam. 出于可交付性的原因,我安装了SPF记录和其他类型的身份验证,以确保不会将生产电子邮件标记为垃圾邮件。 The side-effect is that when I run tests from my localhost they don't work.
副作用是,当我从本地主机运行测试时,它们不起作用。 Is there a "Rails Way" to have development vs. production credentials for a mailer?
是否有“路线”来为邮件提供开发和生产凭证? It seems like I could build my own logic based on the
Rails.env
variable, but I don't want to reinvent the wheel if there is already support for this. 似乎我可以基于
Rails.env
变量构建自己的逻辑,但是如果已有对此的支持,我就不想重新发明轮子。
The "Rails way" is to put shared configuration in config/application.rb
and environment-specific overrides in config/environments/<env>.rb
. “ Rails方式”是将共享配置放在
config/application.rb
,将特定于环境的替代内容放在config/environments/<env>.rb
。
In your case I would put your SPF stuff in config/environments/production.rb
. 在您的情况下,我会将您的SPF内容放入
config/environments/production.rb
。
See this link for more information on configuring ActionMailer: http://guides.rubyonrails.org/action_mailer_basics.html#example-action-mailer-configuration 有关配置ActionMailer的更多信息,请参见以下链接: http : //guides.rubyonrails.org/action_mailer_basics.html#example-action-mailer-configuration
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.