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

Sdílet
Vložit
  • čas přidán 13. 09. 2024
  • 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...

Komentáře • 75

  • @gabrielesanguigno7361
    @gabrielesanguigno7361 Před 4 lety +3

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

  • @mpazaryna
    @mpazaryna Před 4 lety +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!

  • @venkykrishnan2028
    @venkykrishnan2028 Před 3 lety +1

    Thanks for this Sam, simple nice video !!!

  • @samthetester8099
    @samthetester8099 Před 4 lety +3

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

    • @CompleteCoding
      @CompleteCoding  Před 4 lety +1

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

  • @khandoor7228
    @khandoor7228 Před 4 lety +2

    Great video Sam Thank you!

  • @MICAELAABIGAILGORDILLOALCOCER

    Thank you very much, you saved my project ☺

  • @abdelhadidjafer7004
    @abdelhadidjafer7004 Před 2 lety

    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

  • @abhinavsinghal5486
    @abhinavsinghal5486 Před 3 lety

    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  Před 3 lety +1

      This all comes from the first few videos in this playlist
      czcams.com/play/PLmexTtcbIn_gP8bpsUsHfv-58KsKPsGEo.html

  • @indianappguy
    @indianappguy Před 3 lety

    I followed same i am getting Internal server error

    • @CompleteCoding
      @CompleteCoding  Před 3 lety

      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.

  • @zachwhite8054
    @zachwhite8054 Před 4 lety

    awesome video. thank you

  • @RohitPal-lz1wf
    @RohitPal-lz1wf Před 3 lety

    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  Před 3 lety

      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.

  • @madara_u_chiha
    @madara_u_chiha Před 2 lety

    Amazing video!

  • @amarnathmanikandan3693

    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 ?

  • @ahasibrifat7568
    @ahasibrifat7568 Před 2 lety

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

    • @CompleteCoding
      @CompleteCoding  Před 2 lety +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.

  • @neosarchizo
    @neosarchizo Před 4 lety +1

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

    • @CompleteCoding
      @CompleteCoding  Před 4 lety +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 Před 4 lety

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

  • @indianappguy
    @indianappguy Před 3 lety

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

    • @CompleteCoding
      @CompleteCoding  Před 3 lety

      Here's a link to my Full Serverless playlist. If you're starting out then it will teach you everything you need czcams.com/play/PLmexTtcbIn_gP8bpsUsHfv-58KsKPsGEo.html

  • @threeone6012
    @threeone6012 Před 3 lety

    Well done.

  • @Gaurav2964
    @Gaurav2964 Před 3 lety

    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  Před 3 lety

      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: '*'

  • @riazahmad5975
    @riazahmad5975 Před rokem

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

    • @CompleteCoding
      @CompleteCoding  Před rokem

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

  • @amazonses2978
    @amazonses2978 Před 4 lety +2

    Not bad

  • @saiswaroopbedamatta7747

    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  Před 2 lety

      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 Před 2 lety

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

  • @JC-vh7vy
    @JC-vh7vy Před 4 lety

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

    • @CompleteCoding
      @CompleteCoding  Před 4 lety +1

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

  • @varunteja8204
    @varunteja8204 Před rokem

    I am not getting data from postman to event.

    • @CompleteCoding
      @CompleteCoding  Před rokem

      Are you remembering to stringify the response object?

  • @janituma9769
    @janituma9769 Před 3 lety

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

    • @CompleteCoding
      @CompleteCoding  Před 3 lety

      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.

  • @txtinc9823
    @txtinc9823 Před 4 lety

    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  Před 4 lety

      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 Před 3 lety

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

    • @CompleteCoding
      @CompleteCoding  Před 3 lety

      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.

  • @ngneerin
    @ngneerin Před 3 lety

    Use joi for input validation

    • @CompleteCoding
      @CompleteCoding  Před 3 lety

      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 Před 3 lety

      @@CompleteCoding looking forward to that tut

  • @abdoualgerian5396
    @abdoualgerian5396 Před 3 lety

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

    • @CompleteCoding
      @CompleteCoding  Před 3 lety

      Check out the playlist for all videos in order czcams.com/play/PLmexTtcbIn_gP8bpsUsHfv-58KsKPsGEo.html

  • @srav9096
    @srav9096 Před 3 lety

    Can we verify the email/domain with serverless ?

    • @CompleteCoding
      @CompleteCoding  Před 3 lety

      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)

  • @anasamhawech647
    @anasamhawech647 Před 4 lety +1

    still work !

  • @first8208
    @first8208 Před 4 lety

    any source code or git-hub repository?

    • @CompleteCoding
      @CompleteCoding  Před 4 lety

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

    • @first8208
      @first8208 Před 4 lety

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

  • @khushbookabra1354
    @khushbookabra1354 Před 3 lety

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

    • @CompleteCoding
      @CompleteCoding  Před 3 lety +1

      What do you need help with?

    • @khushbookabra1354
      @khushbookabra1354 Před 3 lety

      @@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??????

  • @lucassmith6902
    @lucassmith6902 Před 3 lety

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

    • @CompleteCoding
      @CompleteCoding  Před 2 lety

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