giving back ... gmail

just a quick hack, but useful...

This blog shows how to send mail via gmail.

It does it by replacing some methods in Net::SMTP with versions that
do the right TLS thing (this likely only works on linux, which is fine
for me).

The annoying thing is that with this lib, you can no longer send to a
"normal" smtp server. So I did this...basically just take the old
path if not a gmail smtp server, take the new path if gmail.

require "openssl"
require "net/smtp"


What did you mean "could not send to normal servers"?? Have you seen
paragrapth that starts from "Update 2:"???

I use this Net:SMTP hack with Cerberus (
for sending to gmail and plain local network smtp servers without any

It blows my mind that secure SMTP is *still* not part of Rails. This
hack is nice but it just feels creepy to have to use it ... maybe it's
just me.

Ever since Google Apps for Your Domain ( )
came out, I've stopped worrying about managing my own installs of mail
servers. Ask anyone and they'll tell you that managing these devils
is the bane of server maintenance.

Anyways, I really, really, really hope that someone up high thinks
about adding support for secure SMTP so that we can take advantage of
GMail and all the other secure-only options out there.


I eventually gave up and used python to check gmail :slight_smile: