Action_mailer_tls + Gmail

Check out

First, I'm sorry if I'm repeating much, but I'll give you everything
I've got. I'm not sure what's happening on your end, but here's what
I have. The following is in lib/smtp_tls.rb:

require "openssl"
require "net/smtp"

Net::SMTP.class_eval do
  def do_start(helodomain, user, secret, authtype)
    raise IOError, 'SMTP session already started' if @started
    check_auth_args user, secret, authtype if user or secret

    sock = timeout(@open_timeout) {, @port) }
    @socket =
    @socket.read_timeout = 60 #@read_timeout

    check_response(critical { recv_response() })

    if starttls
      raise 'openssl library not installed' unless defined?(OpenSSL)
      ssl =
      ssl.sync_close = true
      @socket =
      @socket.read_timeout = 60 #@read_timeout

    authenticate user, secret, authtype if user
    @started = true
    unless @started
      # authentication failed, cancel connection.
      @socket.close if not @started and @socket and not
      @socket = nil

  def do_helo(helodomain)
      if @esmtp
        ehlo helodomain
        helo helodomain
    rescue Net::ProtocolError
      if @esmtp
        @esmtp = false
        @error_occured = false

  def starttls
    getok('STARTTLS') rescue return false
  return true

  def quit
    rescue EOFError

Toward the top of my config/environment.rb file, I have:

require 'smtp_tls'

In the do |config| block, I have:

  config.action_mailer.delivery_method = :smtp
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default_charset = 'utf-8'

At the bottom of that same file, I have:

ActionMailer::Base.smtp_settings = {
  :address => "",
  :port => 587,
  :authentication => :plain,
  :user_name => '',
  :password => 'pass'

I think that's everything in my app dealing with email settings. Have
you been able to get it working with sendmail first? Maybe there's
something elsewhere in your app? I haven't used mailer.yml - perhaps
the "old-fashioned" way would work for you?