How to send test email using Nodemailer


If you build your applications using node.js you might use Nodemailer to send your emails. Sooner or later you will want to send fake emails so that you can your software as you build it.

Nodemailer can be set up to use Imitate Email by configuring the SMTP transport correctly. Setting up Imitate Email as your test SMTP server is very easy to do:

Step 1: Set up Imitate Email

If you've not already done so please sign up to Imitate Email.

Step 2: Locate your mailbox credentials

Your username

To locate your username go to Settings > My Mailbox where you will find it (it is the same for all mailboxes in your account)

For the password

If you're on the Free or Developer plan or you're setting this up for your personal mailbox copy the password from the same place as the username.

If you're setting this up for a team mailbox go to Settings > Projects and you will find the password next to the symbol for your mailbox. It will look like the following 6bcb69b2-08ac-4c67-911a-10442f7d84b3

Screenshot of Imitate Email personal settings

Step 3: Send email using Nodemailer

  1. Install Nodemailer from npm
npm install nodemailer
  1. Set up your "transporter":
let transporter = nodemailer.createTransport({
    host: '',
    port: 587,
    secure: false,
    auth: {
        user: '<username from step2>',
        password: '<password from step2>',
  1. Send your email
    from: "",
    to: "",
    subject: "Hi Imitate Email",
    text: "Plaintext version of the message",
    html: "<p>HTML version of the message</p>"
  1. That's it!