Take the 2-minute tour ×

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?

share|improve this question

2 Answers 2

GMail has only SSL SMTP available, so you should create a SSL SMTP connection through Net::SMTP.

Check this article:

share|improve this answer

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.

# MX records are consulted. Commonly mailhosts are named mail.domain.com

# Where will the mail seem to come from?

# The full hostname

# Are users allowed to set their own From: address?
# NO - Use the system generated From: address

# should turn on SSL & auth to google's SMTP server
# TODO change this user

You will want to add this to your environment.rb or production/environment.rb:

ActionMailer::Base.delivery_method = :sendmail
ActionMailer::Base.raise_delivery_errors = true
share|improve this answer
I attempted this, but am getting the following error: Errno::EPIPE in UsersController#create Broken pipe I tested sendmail and ssmtp and can send email to addresses through the terminal outside of rails. Do you have any insight into what may be causing this or what it means? Googling returned no successful solution. –  fossuser Dec 3 '11 at 2:45
Thank you rails casts, this works: railscasts.com/episodes/206-action-mailer-in-rails-3 –  fossuser Dec 5 '11 at 0:48

Your Answer


