Created
April 26, 2018 20:41
-
-
Save chrisguitarguy/4939ccef7301ba3b269f3100c969165c to your computer and use it in GitHub Desktop.
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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