Using Gmail to send mail from Rails
April 18th, 2010
No comments
Recently, I wanted to send email using Google Apps – which requires TLS for their SMTP server.
Using Rails 2.3.5 and putting the following into my environment.rb solved the problem.<
No plugins required.
Maybe this will help someone.
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.default_content_type = "text/html"
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true,
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'GoogleAppsDomain',
:authentication => :plain,
:user_name => 'username@googleappsdomain',
:password => 'password'
}
The key line above clearly is
:enable_starttls_auto => true,
Categories: E-Commerce Platform