Archive

Archive for April, 2010

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 =&gt; true,
:address =&gt; 'smtp.gmail.com',
:port =&gt; 587,
:domain =&gt; 'GoogleAppsDomain',
:authentication =&gt; :plain,
:user_name =&gt; 'username@googleappsdomain',
:password =&gt; 'password'
}

The key line above clearly is

:enable_starttls_auto =&gt; true,

Categories: E-Commerce Platform Tags: