Send email using Lambda and Amazon SES

Поділитися
Вставка
  • Опубліковано 16 січ 2025

КОМЕНТАРІ • 43

  • @KnowledgeAmplifier1
    @KnowledgeAmplifier1  3 роки тому +8

    Code:
    import json
    import boto3
    def lambda_handler(event, context):
    file_name = event['Records'][0]['s3']['object']['key']
    bucketName=event['Records'][0]['s3']['bucket']['name']
    print("Event details : ",event)
    print("File Name : ",file_name)
    print("Bucket Name : ",bucketName)
    subject = 'Event from ' + bucketName
    client = boto3.client("ses")
    body = """

    This is a notification mail to inform you regarding s3 event.
    The file {} is inserted in the {} bucket .
    """.format(file_name, bucketName)
    message = {"Subject": {"Data": subject}, "Body": {"Html": {"Data": body}}}
    response = client.send_email(Source = "Put the sender's mail id", Destination = {"ToAddresses": ["Put Destination Mail id"]}, Message = message)
    print("The mail is sent successfully")

    • @akinadewole696
      @akinadewole696 3 роки тому +1

      Hi, thanks for this video, it actually very helpful on something I am currently trying my hands on, are you able to help with how I can use the same process to send bulk email?

    • @KnowledgeAmplifier1
      @KnowledgeAmplifier1  2 роки тому

      @@akinadewole696 sorry for the late reply , but if you are still looking for solution , then simply call the SendEmail API repeatedly for each email you would like to send or else you can use AWS Pinpoint service 😊 Here is a detail demo on sending multiple mails using this very popular service widely used for marketing -- ua-cam.com/video/gwYhfwKNrbs/v-deo.html
      Happy Learning

  • @piyushraut3715
    @piyushraut3715 Рік тому +1

    Thanks brother.. simply outstanding.well explained

  • @chattorajchattoraj4829
    @chattorajchattoraj4829 10 місяців тому +1

    Nice work Satadru

  • @sunilmadekar321
    @sunilmadekar321 Рік тому +1

    its really helpful and simple content. Thanks

  • @rajshreesahu4956
    @rajshreesahu4956 3 роки тому +2

    Thank you so much✌️

  • @anivesh7769
    @anivesh7769 3 роки тому +2

    Have any other process if i dont verify the reciver mail to send the mail

    • @KnowledgeAmplifier1
      @KnowledgeAmplifier1  2 роки тому

      Hello AnIvEsH , sorry for the late reply , but if you are still looking for solution , then yes , it's possible to send mail without verifying the recipients in amazon ses . Your SES account is in Sandbox Mode. You need to open a request with AWS to take your SES account out of Sandbox Mode. You can follow this documentation to raise request -- docs.aws.amazon.com/ses/latest/dg/request-production-access.html
      Here I demonstrated how to send mail without verifying the destination mail address using AWS Pinpoint -- ua-cam.com/video/gwYhfwKNrbs/v-deo.html
      Hope this will be helpful ! Happy Learning

  • @DevOpsPulse
    @DevOpsPulse 6 місяців тому

    Thank you

  • @hongcai4617
    @hongcai4617 2 роки тому +1

    Thank you for video, very infomative and the code is very useful to start a SES project

    • @KnowledgeAmplifier1
      @KnowledgeAmplifier1  2 роки тому

      Glad to know the video is helpful to you Hong Cai! Happy Learning

  • @hamids2065
    @hamids2065 2 роки тому +3

    Very nice, well explained, the beauty is in the clear and simple instructions without missing any steps, and you created everthing from scratch very nicely. Thanks

  • @Vikaskumar-ur5di
    @Vikaskumar-ur5di 2 роки тому +1

    thanks for sharing easy and clean method

  • @padmanabhkale9385
    @padmanabhkale9385 2 роки тому +1

    Thank you very much, very much needed video..!!!!!!!!

    • @KnowledgeAmplifier1
      @KnowledgeAmplifier1  2 роки тому

      Glad it was helpful Padmanabh Kale! Happy Learning :-)

    • @padmanabhkale9385
      @padmanabhkale9385 2 роки тому

      @@KnowledgeAmplifier1 could you please let me know how to integrate it with Amazon connect

  • @NIYANTAjmp
    @NIYANTAjmp Рік тому +1

    very well explained. keep posting these kind of video

    • @KnowledgeAmplifier1
      @KnowledgeAmplifier1  Рік тому

      Thank you for your feedback Neeraj! I'm glad you found the video helpful. I'll definitely keep posting more videos like this in the future. Stay tuned!

  • @atulkumar7030
    @atulkumar7030 3 роки тому +1

    the destination email needs to be verified ??

    • @KnowledgeAmplifier1
      @KnowledgeAmplifier1  3 роки тому +1

      yes , if your SES account is in Sandbox Mode. If you want to send mail without verifying the recipients in amazon ses , then need to open a request with AWS to take your SES account out of Sandbox Mode. You can follow this documentation to raise request -- docs.aws.amazon.com/ses/latest/dg/request-production-access.html
      Here I demonstrated how to send mail without verifying the destination mail address using AWS Pinpoint -- ua-cam.com/video/gwYhfwKNrbs/v-deo.html
      Hope this will be helpful ! Happy Learning

  • @uppalaadarsh3261
    @uppalaadarsh3261 2 роки тому +1

    Hi I have a requirement
    Calling SES email from Java lambda which is vpc
    Can you please help me..

    • @KnowledgeAmplifier1
      @KnowledgeAmplifier1  2 роки тому

      Hello uppala adarsh, I work with Python & PySpark , left working with Java long back , so don't have any video on Java with SES , but you can refer this documentation which contain all codes on SES Java Integration -- docs.aws.amazon.com/code-samples/latest/catalog/code-catalog-javav2-example_code-ses.html
      Hope this will be helpful! Happy Learning

  • @akinadewole696
    @akinadewole696 3 роки тому +2

    Hi, thanks for this video, it actually very helpful on something I am currently trying my hands on, are you able to help with how I can use the same process to send bulk email?

    • @KnowledgeAmplifier1
      @KnowledgeAmplifier1  2 роки тому

      Hello Akinjide Adewole , sorry for the late reply , but if you are still looking for solution , then simply call the SendEmail API repeatedly for each email you would like to send or else you can use AWS Pinpoint service 😊 Here is a detail demo on sending multiple mails using this very popular service widely used for marketing -- ua-cam.com/video/gwYhfwKNrbs/v-deo.html
      Happy Learning

  • @yuvanshankarn.v9564
    @yuvanshankarn.v9564 3 роки тому

    Can we send any other method without using domain

  • @veerachegu
    @veerachegu 2 роки тому

    I am getting param validation error

  • @nurulhidayah4263
    @nurulhidayah4263 2 роки тому

    Hi, i have a question. Is there any way for me to sent mail to many addresses without the recipient notice that I sent the email to many people in a time ?

  • @KamisettyLakshmichaitrik-rs9lz

    It is showing an error in the lambda function code can you please send the correct code

    • @KnowledgeAmplifier1
      @KnowledgeAmplifier1  Рік тому

      Kamisetty Lakshmi chaitrika I sent the same code which I used in the video 😅Can you please let me know what error are you getting ?

    • @lalithavarma5973
      @lalithavarma5973 Рік тому +1

      We are getting errormeassage: "records" ,
      "ErrorType": "keyError",

    • @KnowledgeAmplifier1
      @KnowledgeAmplifier1  Рік тому

      @@lalithavarma5973 KeyError exception is what is raised when you try to access a key that isn’t in a dictionary (dict). Check whether in cloudwatch logs the filename , bucket name etc. are getting printed properly or not ... if required add an extra print statement before file_name = event['Records'][0]['s3']['object']['key'] line and print the event for which the Lambda is getting triggered , that will help you in debugging ...

    • @yashvinagpal753
      @yashvinagpal753 Рік тому

      Can you provide the exact print statement which needs to be added. I am also facing the same error.

  • @sarulatha7374
    @sarulatha7374 3 роки тому +1

    Hi, Thanks for this awesome video..
    Could pls share a java code for this instead of python...??

    • @KnowledgeAmplifier1
      @KnowledgeAmplifier1  3 роки тому

      Currently no saru latha , I mostly work in Python Language ! You can check in Google.. Happy Learning :-)