npm i aws-sdk
// config.js
import SES from "aws-sdk/clients/ses.js";

export const DATABASE = "mongodb://127.0.0.1:27017/realistcc";

export const EMAIL_FROM = '"John Doe" <youremail@gmail.com>';
export const REPLY_TO = "youremail@gmail.com";

const awsConfig = {
  accessKeyId: "XXXXXXXXX",
  secretAccessKey: "xxxxxxxx/xxxxxxxx",
  region: "us-east-1",
  apiVersion: "2010-12-01",
};

export const AWSSES = new SES(awsConfig);

Now try sending test email from preRegister controller function. To test this, make POST request from Postman.

// controllers/auth
import * as config from "../config.js";

export const preRegister = async (req, res) => {
  try {
    console.log(req.body);

    // send test email
    AWSSES.sendEmail(
      {
        Source: config.EMAIL_FROM,
        Destination: {
          ToAddresses: ["yourmail@gmail.com"],
        },
        Message: {
          Body: {
            Html: {
              Charset: "UTF-8",
              Data: `
                        <html>
                         <h1>Welcome to Realist App</h1>
                        <html>    
                    `,
            },
          },
          Subject: {
            Charset: "UTF-8",
            Data: "Welcome to Realist",
          },
        },
      },
      (err, data) => {
        if (err) {
          console.log("Provide a valid email address", err);
          return res.json({ ok: false });
        } else {
          console.log("Check email to complete registration", data);
          return res.json({ ok: true });
        }
      }
    );
  } catch (err) {
    console.log(err);
  }
};

Now you should receive an email on the email address you used in ToAddresses

Make sure to check spam folder if you don’t see the email.