Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Convert AWS credentials to SMTP password
import base64
import hmac
import hashlib
import sys
def generate_smtp_password(key):
message = "SendRawEmail"
version = '\x02'
h =, message, digestmod=hashlib.sha256)
print base64.b64encode("{0}{1}".format(version, h.digest()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment