Sending Mail Using GMAIL SMTP

Sending mails using the GMAIL SMTP can done using rails smtp_tls plug-in available in the below links.Before downloding the plug-in you should install the action mailer plug-in to support rails mail sending.

http://github.com/openrain/action_mailer_tls/downloads

Download the latested vertion of smtp_tls from the list available, Extract the zip file and navigate to the folder location \lib\smtp_tls.rb. Copy the file and paste it in your aplication lib folder (app\lib)

In your application, open environment.rb file and paste the below content on the bottom of the file

require “smtp_tls”

ActionMailer::Base.smtp_settings = {
:address => “smtp.gmail.com”,
:port => 587,
:domain => ‘gmail.com’,
:user_name => “
yourgmailaccount@gmail.com“,
:password => “password”,
:authentication => :plain
}

ActionMailer::Base.default_content_type = “text/html”

Note:
            The Action mailer setting is not limited to the GMAIL account only. You can use this Action mailer setting for other third party smtp server (YAHOO,HotMail etc) as changing the address,port,username, password and authendication of the above.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: