Categories


Archives


Recent Posts


Categories


Amazon’s SES Signature Version 4 Starting Contest

astorm

Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

a screenshot of my email client with many warnings

Over the past year Amazon’s been sending me a series of escalating emails warning me that it’s shutting off my SES access unless I something something V4 authentication signature. Sometime in April they followed through and stopped letting me use the API. It was time to dissect an old legacy app and figure out what, if anything, I was going to do about this.

This application was built in the days before the AWS PHP SDK — I found a file named ses.php with a few classes in it, and its doc blocks pointed me to this source force page last updated in 2011 and I — already had the latest version. No help from that vendor who I’ve never met, talked to, and haven’t paid a dime. Rude.

I sift through the source and found the spot where headers are set and briefly though about about trying to implement the v4 signatures myself. However, after a series of sometimes circular amazon docs I saw 25 – 50 lines of fiddly code in my future and stepped back. I couldn’t be the only one with this problem, right?

Some googling on the PHP class names turned up this GitHub repository which, according to the original library author (whose website I found), is a semi-blessed fork.

Update: Daniel Zahariev has forked the project and implemented the missing SendRawEmail functionality as well as Sig V4 support. You can download it at his GitHub project page.

It sounds like you need to be named Daniel to work on this project.

The forked version appeared to have implemented the v4 signing I needed and provided the project as a composer package. This composer package was a slight problem as I really didn’t want to rework my old project’s repo and deployment to use composer and turn this into a days long thing so I checked that the PHP cops were on break, and then just concatenated the three classes into a new ses.php.

One quick test later and it seemed like email was flowing again. I briefly considered modernizing this application to use composer and the official AWS SDK like I would if I was doing this for someone else, but instead kick that can down the road. There’s only so much time to spend with the ghost(s) of your formerly successful software business.

I look forward to stumbling on this blog article when, in a few years time, Amazon deprecates something else.

Copyright © Alan Storm 1975 – 2021 All Rights Reserved

Originally Posted: 30th May 2021