开发者

Send different emails using different SMTP Settings in Rails

开发者 https://www.devze.com 2023-03-26 10:10 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消