Today Amazon announced AWS Simple Email Service (SES) beta. SES is a great addition to Amazon Web Services, with it an organization can send marketing, transactional, subscription or system notification messages without have to manage their own messaging infrastructure. And just like all other AWS services it’s pay-as-you-go – even free in some instances.
Soon as I received the announcement from Amazon I immediately set out to give it a try. Since I normally use Windows that’s what I used for this. I ran into a couple of minor problems but was easily able to resolve them and now I’m sending email through SES like a mad man. . .
If you’re anxious to get started and don’t want any fluff here you go. For everyone else read below.
- Sign-up for SES
- Install Perl
- Install XML-LibXML via Perl Package Manager (instructions below)
- Download AWS SES scripts
- Setup “credentials” file (see below for details)
- Get verified: ses-verify-email-address.pl -k creds.txt -v firstname.lastname@example.org
- Send email: ses-send-email.pl -k creds.txt -s "Test One" -f email@example.com firstname.lastname@example.org
SES uses Perl scripts, therefore you must have Perl installed on your Windows machine. I installed ActivePerl Community Edition. Soon as that was done I ran the first SES script to get an email address verified but ran into my first problem – c:perlbin didn’t get added to my path by the installation (for some reason it added c:perlsitebin) so I had to do that manually (if you don’t know how to do this you probably shouldn’t be here anyway. . . )
Amazon Simple Email Service Scripts
Download the SES scripts and save to a useful location – I used d:awsses. This download includes the following SES scripts:
- ses-get-stats.pl – retrieves statistics about Amazon SES account usage
- ses-send-email.pl – send email using Amazon SES
- ses-verify-email-addresses.pl – verify email addresses to be used with Amazon SES
Next problem – when I ran ses-verify-email-address.pl --help I received the message: “Can't locate XML/LibXML.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib.) at D:AWSSESses-verify-email-address.pl line 26. BEGIN failed--compilation aborted at D:AWSSESses-verify-email-address.pl line 26.”
After tooling around the web for a few minutes I realized I needed to manually install XML-LibXML. This was easily done by opening the Perl Package Manager off the Start menu. In there:
- Click the “View All Packages” button or press Ctrl+1
- Type libxml in the search box
- Right-click on XML-LibXML and select Install . . .
- Click File, Run Marked Actions or press Ctrl+Enter
Now when you run ses-verify-email-address.pl --help from the command line you can actually see the help for this command.
Credentials File for SES Commands
All of the SES scripts or commands require authentication to AWS, which makes sense. You can save your credentials (both AWSAccessKeyId and AWSSecretKey) to a file, creds.txt and pass that to each script with the -k <filename> command.
Example credentials file:
Verify Email Address for SES
In order to send any email you must add & verify at least one email address to which you have access. The verification is a two-step process. First run the command: ses-verify-email-address.pl -k creds.txt -v email@example.com. Amazon will send an email to that address with a link to click to finalize verification.
NOTE: Until you are granted production access to Amazon Simple Email Service you can only send to verified addresses. Click to Request for Production Access to Simple Email Service. They say it may take up to 24 hours, but my access request was granted in about 30 minutes – now I can send to any address!
View List of Verified SES Addresses
By running the command ses-verify-email-address.pl -k creds.txt -l you are supposed to be able to view a list of verified addresses, however when I run this nothing is returned. I did discover though that using the --verbose switch, ses-verify-email-address.pl -k creds.txt -l --verbose, I am able to view a list of verified addresses:
Send Email With SES
Finally we are ready to send email using the command ses-send-email.pl -k creds.txt -s "Test One" -f firstname.lastname@example.org email@example.com. Press Enter then you can type the body of your message. When that’s done press CTRL+Z, then Enter. It will hesitate for a second or two while your credentials, etc. are verified and the message is queued. Finally, check your email.
Amazon Simple Email Service looks to be a very useful tool and is a great addition to Amazon Web Services. In just a few minutes you can be sending email through SES, and it can be adapted for myriad purposes. Get started today and start emailing (useful messages – NO SPAM or other crap!).
- SES Getting Started Guide
- Amazon Simple Email Service Developer Resources, which includes details about the service and info for each command.