使用 Rails 中的不同 SMTP 设置发送不同的电子邮件
我有一个应用程序,使用它可以使用 sendgrid 设置向用户发送电子邮件。
现在我想要某些电子邮件(例如异常发生电子邮件)应该使用我的 smtp 设置,而不是通过发送网格设置。
我怎样才能做到这一点?
我在 envirorment.rb 中设置我的电子邮件设置,如下所示:
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_charset = "utf-8"
config.action_mailer.smtp_settings = {
:address => @@config_settings["email_settings"]["address"],
:port => @@config_settings["email_settings"]["port"],
:domain => @@config_settings["email_settings"]["domain"],
:authentication => @@config_settings["email_settings"]["authentication"],
:user_name => @@config_settings["email_settings"]["user_name"],
:password => @@config_settings["email_settings"]["password"]
}
我应该在哪里设置其他电子邮件设置&将其用于某些 Action Mailer 方法。
而且它不应该影响其他 Action Mailer 方法。
I have an application using which i send an emails to users using sendgrid settings.
Now what i want certain email such as Exception Occur Emails should go using my smtp settings and not by send grid settings.
How Can i achieve this?
I set my email settings in enviorment.rb as following
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_charset = "utf-8"
config.action_mailer.smtp_settings = {
:address => @@config_settings["email_settings"]["address"],
:port => @@config_settings["email_settings"]["port"],
:domain => @@config_settings["email_settings"]["domain"],
:authentication => @@config_settings["email_settings"]["authentication"],
:user_name => @@config_settings["email_settings"]["user_name"],
:password => @@config_settings["email_settings"]["password"]
}
Where should i set the other email settings & use it for certain Action Mailer methods.
Also it should not affect the other Action Mailer methods.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论