AmazonSES: Sending your verification email with Railo


I have a client that I am in the process hooking into Amazon’s Simple Email Service for handling their member and mass e-mails.  Originally I was trying to do this through their Google Apps e-mail but it has been problematic at best because Google keeps disabling their mailing account.  Needless to say, it is not fitting their requirements.

My buddy Todd suggested moving them to AmazonSES and after looking their product it looks to be a good fit for my client.  I have not found a wrapper for their API for ACF/Railo so I am working on getting a wrapper together that I will release as well as document the steps you need to take to get this working on your own installation.

The first step in getting AmazonSES working is sending the verification email to your account.  Amazon’s web site has a script written in perl you can use to send it, but I did not feel like installing extra software on my server just to get the account setup.  Instead I decided to do it through the Java API on Railo.   I did not find any examples of how to do it, so I just had to figure it out myself.  Hopefully it will help someone else out.

<cfscript> 
 awsCredentials = createObject("java", "java.io.File").init("#expandpath('.')#/AwsCredentials.properties");
 credentials = createObject("java", "com.amazonaws.auth.PropertiesCredentials").init(awsCredentials);
 email = createObject("java", "com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient").init(credentials);
 verifyRequest = createObject("java", "com.amazonaws.services.simpleemail.model.VerifyEmailAddressRequest").withEmailAddress("your@email.com");
 email.verifyEmailAddress(verifyRequest);
</cfscript>

In the verifyRequest assignment the your@email.com with your personal email address and a verification will be sent to your email.  After activation you can start sending out emails from your verified address. I will put a more detailed installation guide later this evening.

Update: You can also read about the completed AmazonSES component.

About these ads

About Robert Zehnder

Web application developer specializing in ColdFusion/Railo and Open Source development.

Posted on March 31, 2011, in AmazonWS, ColdFusion, Railo and tagged , , . Bookmark the permalink. 2 Comments.

  1. Cool. I went a different route in setting up my SES integration. I dropped down to sendmail and integrated it there. The last thing I wanted was to have to go find every cfmail tag and change it.

    That said, Have you considered creating a tag override for cfmail that could let you specify that you’re using SES. Would be pretty neat if the only change an application had to make was set endpoint=”ses” on any cfmail tags and it would just work.

    Anyway, just a thought :)

    • Honestly I haven’t given it much thought, but it does sound like a great idea. I have seen their example scripts to send the emails through a postfix install on a local server and let that push it to Amazon SES, so it definitely sounds plausible.

      I already have my sendMail method setup and working that accepts basically the same parameters as the cfmail tag. On my clients site I abstract all the email processing to one component, so in my case it would just be a matter of routing through my new sendMail method instead of the one that is currently using cfmail.

      I will look into that though, it could definitely make it easier for folks to get this up and running.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 857 other followers

%d bloggers like this: