How to send an email with Amazon SES and Serverless - tutorial

Поделиться
HTML-код
  • Опубликовано: 6 фев 2025
  • In this video we'll learn how we can set up an API to send an email with Amazon Simple Email Service (SES).
    Code:
    github.com/Sam...

Комментарии • 75

  • @gabrielesanguigno7361
    @gabrielesanguigno7361 4 года назад +3

    One of the few really great tutorials on AWS, well done

  • @mpazaryna
    @mpazaryna 4 года назад +2

    Thank you very much, this was very useful and easy to follow. I've just subscribed and I'm looking forward to more. Best of luck to you!

  • @MICAELAABIGAILGORDILLOALCOCER
    @MICAELAABIGAILGORDILLOALCOCER Год назад

    Thank you very much, you saved my project ☺

  • @samthetester8099
    @samthetester8099 4 года назад +3

    Wow, Thanks for the tutorial. This is what I was looking for........

    • @CompleteCoding
      @CompleteCoding  4 года назад +1

      Thats a great idea. I'll add it to the list of future videos :)

  • @venkykrishnan2028
    @venkykrishnan2028 3 года назад +1

    Thanks for this Sam, simple nice video !!!

  • @khandoor7228
    @khandoor7228 4 года назад +2

    Great video Sam Thank you!

  • @ahasibrifat7568
    @ahasibrifat7568 2 года назад

    10:15 does it gives permission all other lambdas to send email?? possible to make role lambda specific?

    • @CompleteCoding
      @CompleteCoding  2 года назад +2

      Yes, this is for all lambdas. setting up lambda specific permissions is a bit much for this video
      there's a plugin called `serverless-iam-roles-per-function` which does exactly what you want and is what I use when we have to have very fine control over IAM permissions.

  • @abdelhadidjafer7004
    @abdelhadidjafer7004 2 года назад

    Hi sam , amazing job again , wroth to note after the aws changes there has to be some extra console configuration to work, by just adding some extra permission to the email verified

    • @CompleteCoding
      @CompleteCoding  2 года назад +1

      Thanks for the info! AWS changes so often

  • @amarnathmanikandan3693
    @amarnathmanikandan3693 2 года назад

    Using serverless.yml configuration how can I create a SES email configuration that is linked/configured with a cognito user pool and its mapped to S3 bucket. Please help if you have any info regarding this ?

  • @indianappguy
    @indianappguy 3 года назад

    I followed same i am getting Internal server error

    • @CompleteCoding
      @CompleteCoding  3 года назад

      Have a look in the logs of your lambda and see what the issue is. It might be a typo or that you haven't enabled the email address or something else.

  • @Gaurav2964
    @Gaurav2964 4 года назад

    This works when I run it locally. But doesn't work when I deploy it on AWS and try running it from there. I have created an IAM policy, and used policy's ARN in my serverless yml file to allow sending emails

    • @CompleteCoding
      @CompleteCoding  4 года назад

      You should just be able to add something like this to your serverless.yml file in the provider section and that will give your lambda the permissions it needs.
      iamRoleStatements:
      - Effect: Allow
      Action:
      - ses:*
      Resource: '*'

  • @madara_u_chiha
    @madara_u_chiha 3 года назад

    Amazing video!

  • @abhinavsinghal5486
    @abhinavsinghal5486 3 года назад

    Great tutorial , really appreciate it. I see that you have used an existing project. Is it possible to guide what was the first project where you did the initial setup i.e myserverless project

    • @CompleteCoding
      @CompleteCoding  3 года назад +1

      This all comes from the first few videos in this playlist
      ruclips.net/p/PLmexTtcbIn_gP8bpsUsHfv-58KsKPsGEo

  • @neosarchizo
    @neosarchizo 4 года назад +1

    Good! How can I check the endpoints I generated before?

    • @CompleteCoding
      @CompleteCoding  4 года назад +1

      There are a few ways to test your functions before deployment. Serverless offline can work for a few things but things like SES won't work.
      You could write unit tests and check that way.
      Often the easiest way is to deploy them and just check. You then have a development branch which deploys to the dev stage and master which deploys to prod. This way you get two separate environments

    • @neosarchizo
      @neosarchizo 4 года назад

      @@CompleteCoding Thanks for the reply. But I asked it wrongly. Sorry. I wanna recheck my endpoints URL that I generated already.

  • @janituma9769
    @janituma9769 4 года назад

    What if a customer response to the email ? It will not work because of SMTP right ? What to configure to receive emails ?

    • @CompleteCoding
      @CompleteCoding  4 года назад

      Amazon SES also has the ability to receive emails and I've built a full email customer service tool before. This is a lot more complex than sending an email and involves activating a domain name on your account.

  • @JC-vh7vy
    @JC-vh7vy 4 года назад

    Extension are yuou using that lets you navigate the funcions of the file?

    • @CompleteCoding
      @CompleteCoding  4 года назад +1

      That is just part of vs code. It is "view function" which is defaulted to f12 I think.

  • @indianappguy
    @indianappguy 3 года назад

    I am beginner to this if you have in depth tutorial please guide me

    • @CompleteCoding
      @CompleteCoding  3 года назад

      Here's a link to my Full Serverless playlist. If you're starting out then it will teach you everything you need ruclips.net/p/PLmexTtcbIn_gP8bpsUsHfv-58KsKPsGEo

  • @RohitPal-lz1wf
    @RohitPal-lz1wf 3 года назад

    Great stuff mate. Can you please setup this with using Express framework because i was using that technique but somehow not working for me.

    • @CompleteCoding
      @CompleteCoding  3 года назад

      It depends how you are using express. If you are running express in a Lambda then it should all work.
      If you are running the express locally or hosting it somewhere then it won't have permissions to use the AWS services in that AWS account. You could create a 'ses-user' and then use the credentials with the AWS-SDK in the code, but this is a lot more effort than just using Serverless.

  • @saiswaroopbedamatta7747
    @saiswaroopbedamatta7747 3 года назад

    Hi thanks for this amazing video, I have a query, how can i send an email template from ses ? Can i do this it this method ? please help.

    • @CompleteCoding
      @CompleteCoding  3 года назад

      Yes you can. You can have your template either in the lambda or stored in S3. You then just insert the values you want and then send the sdk call
      const params = {
      ...,
      Message: {
      Body: {
      Html: {
      Charset: "UTF-8",
      Data: "HTML_FORMAT_BODY - GENERATED FROM YOUR TEMPLATE"
      },
      }}}

    • @saiswaroopbedamatta7747
      @saiswaroopbedamatta7747 3 года назад

      @@CompleteCoding I have my template at ses email template, can it be used from there ?

  • @threeone6012
    @threeone6012 3 года назад

    Well done.

  • @varunteja8204
    @varunteja8204 2 года назад

    I am not getting data from postman to event.

    • @CompleteCoding
      @CompleteCoding  2 года назад

      Are you remembering to stringify the response object?

  • @srav9096
    @srav9096 3 года назад

    Can we verify the email/domain with serverless ?

    • @CompleteCoding
      @CompleteCoding  3 года назад

      Unfortunately not. If you are verifying an email then it needs to be done directly in SES. If you're verifying a domain then that's done in Route53 (or if you buy the domain from route53)

  • @CodeXpert-p8g
    @CodeXpert-p8g 2 года назад

    please make video on how to make email template and send email ..

    • @CompleteCoding
      @CompleteCoding  2 года назад

      You could store your email templates in S3 or Dynamo ( as html) then just add your variables and send it this same way

  • @txtinc9823
    @txtinc9823 4 года назад

    Hi Complete Coding, I have followed your tutorial but everytime I send an email out, the bounce rate is followed increasing. How can I solve it?
    I have added an unsubscribe link at the bottom of the email but still no luck to stop the bounce rate incresed.
    *Could you also teach us how can we avoid or minimise the bounce rate.

    • @CompleteCoding
      @CompleteCoding  4 года назад

      I'm not en expert on email optimisation but from what I have learnt it is normally due to the content of the email and if other recipients have classed it as spam.
      To get less bounce, make sure that the people who send it to are likely to open it. This might mean only sending it to a smaller group who you know will open it. The more people open it, the less likely it is to be classed as spam. Over time Gmail (or other email clients) will learn that it isn't spam.
      Make sure you're only sending emails to users who have said that they want to get the emails.
      If you are sending the same email to lots of people (newsletter) then you would be better using a different service who specialises in bulk emailing (mailgun).

  • @artofcode7
    @artofcode7 3 года назад

    My emails is going to span... How can i fix it?

    • @CompleteCoding
      @CompleteCoding  3 года назад

      This is because google (or other email providers) aren't expecting emails from your email address to come from AWS. The way to improve this is to have more users mark the email as 'not spam'.
      Because it is so easy to send thousands of emails, spam marketers have abused it so email providers have learnt that they're often spam.
      Other ways to reduce the spam rate is to use a business email address with a reputable domain name and not just a name@gmail.com address to send from.

  • @zachwhite8054
    @zachwhite8054 4 года назад

    awesome video. thank you

  • @ngneerin
    @ngneerin 4 года назад

    Use joi for input validation

    • @CompleteCoding
      @CompleteCoding  4 года назад

      There are some really good libraries for data validation. In these videos I try and focus on one thing (SES) and data validation can be so complex it could have its own video.

    • @ngneerin
      @ngneerin 4 года назад

      @@CompleteCoding looking forward to that tut

  • @abdoualgerian5396
    @abdoualgerian5396 4 года назад

    where is the previous videos !!!! please label them with nimbers

    • @CompleteCoding
      @CompleteCoding  4 года назад

      Check out the playlist for all videos in order ruclips.net/p/PLmexTtcbIn_gP8bpsUsHfv-58KsKPsGEo

  • @MegaxAT
    @MegaxAT 4 года назад

    any source code or git-hub repository?

    • @CompleteCoding
      @CompleteCoding  4 года назад

      Hi Jaber. I've also added it to the description.Thanks for point that out
      github.com/SamWSoftware/ServerlessRUclipsSeries/tree/l12-ses

    • @MegaxAT
      @MegaxAT 4 года назад

      @@CompleteCoding very much appreciated... thnx : )

  • @amazonses2978
    @amazonses2978 5 лет назад +2

    Not bad

    • @CompleteCoding
      @CompleteCoding  5 лет назад +1

      Thanks! That means a lot coming from you :D

  • @khushbookabra1354
    @khushbookabra1354 4 года назад

    Sir i need your help...if possible for you then please help!!!!

    • @CompleteCoding
      @CompleteCoding  4 года назад +1

      What do you need help with?

    • @khushbookabra1354
      @khushbookabra1354 4 года назад

      @@CompleteCoding I had done with sending of Emails with Aws (code in NodeJs without using serverless).....But i m not getting records to whom i had send the Emails?????.....And i also want to receive Emails with attachments and stored in Database, how i have to proceed for that??????

  • @anasamhawech647
    @anasamhawech647 4 года назад +1

    still work !

  • @lucassmith6902
    @lucassmith6902 4 года назад

    Can you help me to get AWS ACCOUNT I we pay 💰 money

    • @CompleteCoding
      @CompleteCoding  3 года назад

      Getting an AWS account is pretty simple. There are a lot of tutorials on how to do it out there