Forked from nktstudios/AWS Lambda Function to Send Email
Created
December 5, 2021 12:58
-
-
Save Bharathkumarraju/af76772d93c82886bafc083a21a48c6f to your computer and use it in GitHub Desktop.
AWS Lambda Function to Send Email
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
import json | |
import boto3 | |
def lambda_handler(event, context): | |
ses = boto3.client('ses') | |
body = """ | |
Hello and welcome to the SES Lambda Python Demo. | |
Regards, | |
NKT Studios | |
""" | |
ses.send_email( | |
Source = 'insert FROM address here', | |
Destination = { | |
'ToAddresses': [ | |
'Insert TO address here' | |
] | |
}, | |
Message = { | |
'Subject': { | |
'Data': 'SES Demo', | |
'Charset': 'UTF-8' | |
}, | |
'Body': { | |
'Text':{ | |
'Data': body, | |
'Charset': 'UTF-8' | |
} | |
} | |
} | |
) | |
return { | |
'statusCode': 200, | |
'body': json.dumps('Successfully sent email from Lambda using Amazon SES') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment