Skip to content

Instantly share code, notes, and snippets.

@citmusa
Created October 27, 2016 17:09
Show Gist options
  • Save citmusa/6887b1b40719453698d736717c909bda to your computer and use it in GitHub Desktop.
Save citmusa/6887b1b40719453698d736717c909bda to your computer and use it in GitHub Desktop.
send email with amazon SES service
# 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