How To: Send Email Using Lambda & AWS SES (2 Min)

preview_player
Показать описание
In this tutorial, you'll learn how to send an email using a Lambda function with the help of AWS SES (Simple Email Service).



Video Transcript:

Hi guys, this is Abhi fromGokcedb. In this video, you are going to learn how to send an email using a Lambda function, using the AWS SES Service. Let’s start by searching for SES in the AWS Console.

Next, hit Create Identity and choose the email address for Identity Type. Enter your email address then click on the Create Identity button. Now go to your inbox to verify your email address then refresh this page.  

Next, go to the AWS Console page and search for IAM which stands for identity and Access Management. Click on roles in the left menu then hit the create role button. Select Lambda and click on next.  

Search for then select Amazon SES Full and hit access. Give this role a name then clicks on Create Role.  Go back to the AWS Console and this time search for Lambda.

Click on Create function then give it a name. For runtime, I’m going to select Python and for the Default Execution role, I’m going to select the role that we just created. In the Code Source section, I’m going to copy-paste pre-written Python Code.  

On line 2, I’m importing theboto3 library which is the SDK for AWS. On line 5, I’m defining the SES Client as an online eight, I’m constructing the email subject and the body.  

Online nine, I’m using the send underscore email method to send an email. Next, click on deploy and then hit the test button. Give your test event a name then hit same.

Click on the test button again to test your Lambda function. Looks like the function worked as expected and I can see a new email in my inbox.  There you have it.

Make sure you like, subscribe, and turn on the notification bell. Until next time.

import json
import boto3

def lambda_handler(event, context):
subject = "test subject from lambda"
body = "test body from lambda"
message = {"Subject": {"Data": subject}, "Body": {"Html": {"Data": body}}}
return response
Рекомендации по теме
Комментарии
Автор

the point. Other videos on same topics are around 15 minutes and this guy did it in 2 minutes.

zohabali
Автор

Gokce you are a tutorial genius! Well done!

otzlnqi
Автор

thanks for the super quick tutorial! you're a legend for doing this. I'm currently building a static webpage hosted in S3 as a beginner project. It's hosting an embedded Resume` and a couple of YouTube videos of some of the work I've done for video games (audio). How can I go about combining this to my contact form on my static website?

alanhatfield
Автор

mawa niku danda esii dandam pettali


Thankyou so much
You saved my btech

Tejendra_
Автор

right to the point of the problem really thanks sir!

daner
Автор

Hi works great for me thank you for the video!! I was wondering how to send emails to other people. It keeps saying it fails when trying to. Thank you again

devdhawan
Автор

great video, if anyone wants to remove the yellow warning, add a new verified email then use different emails for the to and from.

jordanfong
Автор

@Gokce DB....spectacular presentation...Are you a web dev?😊

bert
Автор

Thanks it’s working, but I have a question
I am building server-less contact is form using API gateway Lamda function SES,

How can I get extract the input data using this code PY code and receive that in registered email.
Pleas help.

mohamedali
Автор

when should i create smtp credentials?

ShriHari-oett
Автор

Yea but how does this work in production? How are you going to verify the sender?

dzfrbig