Rails ActionMailer with multiple SMTP servers

前端 未结 11 1077
一整个雨季
一整个雨季 2020-12-13 06:19

I have a need to use two different smtp servers in a Rails application. It appears that the way ActionMailer is constructed, it is not possible to have different smtp_settin

11条回答
  •  [愿得一人]
    2020-12-13 06:57

    When I wanted a quick test in the console (Rails 5) I did the following:

    settings = { username: "" } # etc
    mailer = MyMailer.some_method
    mailer.delivery_method.settings.merge!(settings)
    mailer.deliver
    

提交回复
热议问题