If you are like me, you hate spam. You know what I hate more that
that? Managing my own mail server and dns. We are a small shop that
does GIS Application work, and have been running our own mail server
since 1998. As you probably know, spam was almost non existent back
then. Well, fast forward to today, and its insane. I don't have 4 hours
to spend with tech support to figure out how my box was compromised and
became a spam relay. I don't have time to figure out why the guy who
sits across from me can't get his mail. I have code to write and
clients to make happy. So, here is what I did about it.
1. Got an account at ZoneEdit.
They are a free DNS service that is extremely fast and reliable. I
have been using them for my personal site (on a dynamic ip) for years. I
finally decided it was time to move the work sites there. I just
logged into my domain registrar and changed the name server from my
machine to zoneEdit's. It was that easy.
2. Got an account at Google Apps for Your Domain.
I cannot believe this is free. Essentially, all I had to do was move
my MX records fom my dns server here in the office to zoneedit. Once on
zoneEdit, I just pointed it to Google's mail server (which are provide
in the Google account creation) instead of the one I have in my office.
Creating all the new email accounts was as easy as uploading a CSV
file. Now, once each user visits the new sign in page, all they do is
enable POP access and change their mail server settings in their mail
client of choice. The bonus here is that you get nice web client
(gmail) and 2gb of storage. You can even brand the site with your own
logo. They also have a very impressive calendar app which can be shared
(ala exchange) among all your domain users. Like I said I can't
believe it was all free.
Ok, so now I am all set. Everyone can
get email and I don't touch anything. BUT, this did leave me with a
problem. How can I send email programmatically using Coldfusion?
Google requires the SMTP server to first create a SSL session on port
465. I tried and tried, but I just couldn't get Coldfusion and CFMAIL
to send. I guess it doesn't support SSL connections. So I began my
search...And I can up with this post on usnet. This isn't my code, but
if someone knows who did it, give them a big thank you! Here it is:
First view this: http://www.jscape.com/articles/sending_email_smtp_ssl_gmail.html
1. Create the new folder secure_inet in C:\CFusionMX7\Mail;
2. On the jscape.com page above, click on the link to
download "Secure iNet Factory";
3. Enter your e-mail address and agree to the terms;
4. Download setup.exe ;
5. Launch the setup executable and choose to extract to the directory
C:\CFusionMX7\Mail\secure_inet . This ensures that the key JAR file,
sinetfactory.Jar will be stored as
6. In the Coldfusion Administrator, add this to the JVM classpath:
7. Restart the Coldfusion MX server service.
8. Run the coldfusion script. It should go like an intercity train.
// create new instance
// address the message
email_message.setHtmlBody("the body of the message");
// connect, send the message, disconnect
SSL_SMTP_obj.login("your GMAIL user account","GmailPassowrd");
That’s it, works like a champ. Only issue is that Secure iNet Factory does cost a couple of bucks.
know what the bonus of it all is? I have not gotten a single piece of
spam in my inbox, and not a single false positive. Even with my old
mail server spam filter (it did catch about 90% of it), I used to get
about 20 spams per day in my inbox. So, that’s my story. I am one