Using GMail SMTP in ActionMailer
Rail's ActionMailer was simply the automatic choice, since I am building a rails app.
Turns out GMail supports only SSL SMTP mailing service, meaning if you cannot create a SSL connection to its SMTP server, you cannot send email through them. DHH writes about how to do so through installing msmtp here, but we developers just obviously love more choices.
Anatol Pomozov has developed a library called smtp_tls.rb . It allows us to use SMTP Server with TLS. Just follow the instruction in the original post, and then insert
require ‘smtp_tls’
under config/enviroment.rb
Finally, under config/enviroments/xxxxx.rb to specify Gmail settings
ActionMailer::Base.server_settings = {
:address => "smtp.gmail.com",
:port => "587",
:domain => "localhost.localdomain",
:authentication => :plain,
:user_name => "your Gmail account",
:password => "your Gmail Password"
}
沒有留言:
發佈留言