Send Emails using Amazon SES and Node.js

Amazon SES (Simple Email Service) is a solution that Amazon provides for sending emails. This service encourages you to pay Amazon what you use, so you can use as much or as little email you like. The coding example below shows how to configure Amazon SES in Node.js.

Check Github


Install Node Mailer

Node Mailer is one of my favorite library to send email. Fortunately, It supports Amazon SES. Yeay!

$ npm install nodemailer

To use Amazon SES, we need one more step to install Node Mailer SES transport.

$ npm install nodemailer-ses-transport

Setup Node Mailer

Add require node mailer lines in your file.

var nodemailer = require('nodemailer');
var ses = require('nodemailer-ses-transport');

Then we must add SES transport in nodemailer then add our Amazon key and secret key.

var transporter = nodemailer.createTransport(ses({
    accessKeyId: 'YOUR_AMAZON_KEY',
    secretAccessKey: 'YOUR_AMAZON_SECRET_KEY'

Send Simple Email

We almost finish. Next step is we can use our created transporter to send email.

from: ‘’,
to: ‘’,
subject: ‘My Amazon SES Simple Email’,
text: ‘Amazon SES is cool’

Please remember that you need to setup valid email address for from. If not, Amazon SES will not recognize the sender.

Result of sending simple email


Send Email with CC and BCC

from: ‘’,
to: ‘’,
subject: ‘My Amazon SES Email with CC and BCC’,
text: ‘Amazon SES CC and BCC is cool’,
cc: ‘,’,
bcc: ‘’

To configure multiple cc/bcc email addresses, the emails are separated by comma e.g ‘,’.

Result of sending email with cc and bcc


Send Email with Attachment

You can also use Amazon SES for sending attachment.

from: ‘’,
to: ‘’,
subject: ‘My Amazon SES Email with Attachment’,
text: ‘Amazon SES Attachment is cool’,
attachments: [
filename: ‘My Cool Document’,
path: ‘https://path/to/cool-document.docx’,
contentType: ‘application/vnd.openxmlformats-officedocument.wordprocessingml.document’

For attachment, you should ensure that the attachment path can be accessed publicly. You also need to put the correct contentType. Please refer to Mime Type List for complete reference.

Result of sending email with attachment


In this article, we have setup Amazon SES with Node.js for sending emails. We use nodemailer package that supports Amazon SES. Amazon SES can send email using cc, bcc and even attachment.

  • Arun Srinivaas

    Not working. Geeting Error – The request signature we calculated does not match the signature you provided .

    Session keys valid. For sandbox ses account, emails are verified.

  • Your examples work very well. Thanks for posting this!

    I would like to say no problems at all except that when I set the JSON key to: to a variable send fails.

    • deerawan


  • chetan kantharia

    I am having issue It says ‘SignatureDoesNotMatch’

    • deerawan

      Hi Chetan,

      As I remember, that issue may be caused by the access key and secret key. Have you solved the problem?

      • chetan kantharia

        Hi Deerawan,

        Problem is solved and you are right I was some problem with keys and zone which I was using.

        Thanks :)

        • deerawan

          sweet! Glad to hear that

        • Shubham Waghe

          Can you please tell some steps in detail to solve the problem. Many people including me are facing the exact same problem. Thank you!

          • Rahul

            Hi I am facing same error. My Access key and Secret are perfect, but still facing same issue.
            FYI, This is working in php.

  • How can I solve this error: “The following identities failed the check in region US-WEST-2:”

    • var smtpTransport = nodemailer.createTransport(ses({
      region: “us-west-2″,
      accessKeyId: process.env.AWS_ACCESS_ID,
      secretAccessKey: process.env.AWS_ACCESS_KEY

  • Василь Петров

    how add body(htlm) to email, not attachments

    • Василь Петров

      I find property “html”, i saw on model. Thanks!