Agile Web Development

Build it. Launch it. Love it.

ActionMailer TLS

This plugin allows ActionMailer to work with SMTP servers that require TLS. It is heavily monkeypatched into ActionMailer and Net/SMTP, but such is life. Just set the following, and proceed as usual:

ActionMailer::Base.server_settings[:tls] = true

I haven’t quite figured out the best way to test this plugin, but if you execute the following command, you should receive a gmail from yourself, and a fair amount of debug information will be output. I hope it suffices; if not, suggest an improvement!

rake EMAIL=my_gmail_account@gmail.com PASSWORD=secret

Vitals

Repository http://svn.douglasfshearer.com/rails/plugins/action_mailer_optional_tls
License Rails' (MIT)
Tags Tag_red foxmail GAYD gmail mail ssl tls
Rating (13 votes)
Owner Kyle Maxwell
Created 22 August 2006

Comments

  • Toine Diepstraten
    19 July 2007

    Nice work!

    Only problem it seems to throw a SSL exception "Wrong Version number" right after the email was accepted by the SMTP server, when used with an gmail account (tested with Ruby 1.8.6, Rails 1.2.3 that is).

  • 22 August 2007

    Hello, that's a great sample! Though it seems to fail for me (ruby 1.8.5 with rails 1.2.3)

    While testing, I get this error: testsendmail(TlsTest): Errno::EBADF: Bad file descriptor - connect(2) lib/smtp_tls.rb:34:in initialize' lib/smtp_tls.rb:34:inopen' lib/smtp_tls.rb:34:in do_tls_start' c:/ruby/lib/ruby/1.8/timeout.rb:56:intimeout' c:/ruby/lib/ruby/1.8/timeout.rb:76:in timeout' lib/smtp_tls.rb:34:indotlsstart' lib/smtp_tls.rb:18:in send' lib/smtp_tls.rb:18:instart' lib/smtp_tls.rb:10:in start' lib/action_mailer_tls.rb:9:inperformdeliverysmtp' c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/base.rb:451:in send' c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/base.rb:451:indeliver!' c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/base.rb:333:in method_missing' ./test/tls_test.rb:30:intestsendmail'

    I wonder if you possibly could suggest anything...

    Thanks a lot!

  • Maksim Khrapov
    1 July 2008

    The repository seems to have disappeared.

  • GreenAsJade
    25 February 2009

    The test didn't work - it seems to assume it has root access to the db or somefink.

    But the actual emailing worked like a treat :) :)

Add a comment