In my environment.rb file I have:
ActionMailer::Base.smtp_settings = {
:address => "smtp.example_host.com",
:port => '25',
:domain => "example_send_from.com",
:authentication => :plain,
:user_name => "send_account_name",
:password => ENV['MY_EMAIL_SEND_PWD']
}
It works fine.
However, now my app has a new class of emails that need to be sent via a different email account... perhaps gmail in some low-volume cases, sendgrid in other high volume cases.
I'm sure it's pretty simple -- but how do I override the default Base.smtp_settings
setting on an email-by-email basis?
do you have separate actionmailers for each email account? then you could set the smtp settings per action mailer-class:
class Mailer1 < ....
self.smtp_settings = { .... }
end
etc.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.