On the suggestions of Chris Corbyn I re-wrote my class to use direct access and the Swiftmailer byte stream interface, no cURL anymore. It’s way faster, and way cooler, if I do say so myself. You can get the latest at https://github.com/jmhobbs/Swiftmailer-Transport–AWS-SES
Not a lot of stuff out there for it so I thought I’d jump the gun a bit and write a transport for PHP’s Swiftmailer. If you have to send e-mail from your sever and from PHP, Swiftmailer is your best friend.
Never dug into Swiftmailer’s guts before, but it’s pretty well laid out. All you have to do for a new transport is implement the send method of the Transport interface and you are done.
I knocked mine together pretty quick, and the only code I cribbed was the HMAC code from php-aws, because AWS was rejecting the output from hash_hmac. (Which I literally just figured out while I wrote that paragraph. Works now.)
So how hard is it to use? Easy as any other transport in Swiftmailer.
//Create the Transport
$transport = new Swift_AWSTransport(
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
//Create the message
$message = Swift_Message::newInstance()
Dude, I'm <b>totally</b> sending you email via AWS.
$mailer->send( $message );
So, yeah, it works.
I know there is a ton of stuff I didn’t implement that I need to before this could be “production” ready, but it was a very satisfying little project.
You can grab it here: https://github.com/jmhobbs/Swiftmailer-Transport–AWS-SES