Articles → NODE.JS → Send An Email By Calling Amazon SES Using Node.Js

Send An Email By Calling Amazon SES Using Node.Js


  1. Generate access and secret keys of the user.
  2. Verify email addresses (sender and receiver) in SES.
  3. Add user credential in the "credentials" file.
  4. Write code to send an email.
  5. Output.

Generate Access And Secret Keys Of The User

Verify Email Addresses (Sender And Receiver) In SES

Picture showing verifying the sender and recipient email addresss

Click to Enlarge

Add User Credential In The “Credentials” File


Picture showing credentials file for storing credentials

Click to Enlarge

Write Code To Send An Email

npm install aws-sdk

var aws = require('aws-sdk');

aws.config.getCredentials(function (err) {
    if (err) console.log(err.stack);    
    else {
        //console.log("Access key:", aws.config.credentials.accessKeyId);

var ses = new aws.SES({
    region: 'ap-south-1'

handler = function () {
    //console.log("Incoming: ", event);
    var eParams = {
        Destination: {
            ToAddresses: [""]
        Message: {
            Body: {
                Text: {
                    Data: "Lambda is working"
            Subject: {
                Data: "Mail From SES"

        Source: ""
    console.log('===Sending Email====');
    var email = ses.sendEmail(eParams, function (err, data) {

        if (err) console.log(err);
        else {
            console.log('===Email Sent====');



Picture showing the email sent through SES using node.js

Click to Enlarge

Posted By  -  Karan Gupta
Posted On  -  Monday, November 29, 2021


Your Email Id  
Query/FeedbackCharacters remaining 250