Configure actionmailer to send emails using Gmail

Source: Internet
Author: User
Configure actionmailer to send mail via Gmail by YuanYi Zhang | published: November 26,200 8

This problem has been around for a long time. I compared several existing solutions and found that the Robert bousquet solution is the simplest.

1. Robert only provides a source code download link, which is not very convenient. I put it on GitHub:


$ script/plugin install git://github.com/yzhang/smtp_tls.git

2. Modify environment. RB:


require "smtp_tls"
mailer_config = File.open("#{RAILS_ROOT}/config/mailer.yml")
mailer_options = YAML.load(mailer_config)
ActionMailer::Base.smtp_settings = mailer_options

3. Create config/mailer. yml

-
: Address: smtp.gmail.com
Port: 587
: User_name: john@doe.com
: Password: s1j234gh
: Authentication: Plain

4. If you use the exceptionnotification plug-in, make sure that the sender settings of exceptionnotification are consistent with your Gmail account; otherwise, Gmail will reject sending.

From: www.letrails.cn

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.