I would like to test my ActionMailer class, but don't have an smtp server. I would like to use gmail to send such emails. Could someone provide a sample with all the necessary configurations both on google and whatever config files in the app.
thanks
From stackoverflow
-
GMail has only SSL SMTP available, so you should create a SSL SMTP connection through Net::SMTP.
Check this article:
-
I do this with SSMTP. It acts as an SMTP server and proxies to a real SMTP server. On Unix (Ubuntu hardy in this case) it makes the system sendmail work properly.
If you're also on Ubuntu, run
apt-get install ssmtp
to get it.This is a sample config file based on mine.
# # Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=postmaster # The place where the mail goes. The actual machine name is required no # MX records are consulted. Commonly mailhosts are named mail.domain.com #mailhub=aspmx.l.google.com mailhub=smtp.gmail.com:587 # Where will the mail seem to come from? rewriteDomain=example.com # The full hostname hostname=yourhostname.example.com # Are users allowed to set their own From: address? # YES - Allow the user to specify their own From: address # NO - Use the system generated From: address FromLineOverride=YES # should turn on SSL & auth to google's SMTP server # TODO change this user UseTLS=YES UseSTARTTLS=YES AuthUser=yourgoogleuser@example.com.com AuthPass=yourgooglepassword
You will want to add this to your
environment.rb
orproduction/environment.rb
:ActionMailer::Base.delivery_method = :sendmail ActionMailer::Base.raise_delivery_errors = true
0 comments:
Post a Comment