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("email@example.com"); email.verifyEmailAddress(verifyRequest); </cfscript>
In the verifyRequest assignment the firstname.lastname@example.org 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.