Created
October 27, 2016 17:09
-
-
Save citmusa/6887b1b40719453698d736717c909bda to your computer and use it in GitHub Desktop.
send email with amazon SES service
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
# pip install boto3 | |
import boto3 | |
client = boto3.client('ses', | |
aws_access_key_id='XXXXXXXXXXXXXXXX', | |
aws_secret_access_key='XXXXXXXXXXXXXXXX', | |
region_name='us-east-1') | |
try: | |
response = client.send_email(Source='from@emaildomain.com', | |
Destination={'ToAddresses':['toemail@address.com']}, | |
Message={'Subject':{'Data':'Hola mira mi correo', 'Charset':'utf-8'}, | |
'Body':{'Text':{'Data':'saludos cordiales', 'Charset':'utf-8'}, | |
'Html':{'Data':'saludos cordiales', 'Charset':'utf-8'}} | |
} | |
) | |
except: | |
print "Error" | |
else: | |
print "Email sent, this is the response:" | |
print response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment