Hello people!
I would like to send a small amount of email from my app through Gmail. Now, the SMTP settings will be determined at runtime (ie: from the db), can this be done?
--- edit ---
I can set the ActionMailer subclass (named Notifier) smtp settings in one of the class' methods. This way I can set the username and password for sending the email dynamically. The only thing is that you have to set ALL the smtp_settings. Is it possible to set just the username & password settings in the class method?
This is the code I'm using right now, it is sending:
class Notifier < ActionMailer::Base
def call(user)
Notifier.smtp_settings = {
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => "587",
:domain => "mydomain.com",
:authentication => :plain,
:user_name => "[email protected]",
:password => "password"
}
recipients user.email
subject "Test test"
body "Test"
end
end
I would like to just set the username and pw here.