Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to generate AWS SES SMTP passwords from an already existing IAM User secret key. In PHP. See https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html#smtp-credentials-convert
<?php
$key = getenv('AWS_SECRET_ACCESS_KEY');
if (!$key) {
throw new \LogicException('Missing AWS_SECRET_ACCESS_KEY');
}
$sig = hash_hmac('sha256', 'SendRawEmail', $key, true);
echo base64_encode(pack('C', 0x02) . $sig), PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment