Search code examples
node.jsamazon-sesaws-sdk-js

Sending Email with Dedicated IP Managed Pool with AWS JS SDK V3


I am trying to send an email using a dedicated IP managed pool. I am using the module @aws-sdk/client-ses with node js. Here is my code

const { SESClient, SendEmailCommand } = require("@aws-sdk/client-ses");

const ses = new SESClient({ region: "us-west-2" });

const send_ses = async () => {
  const emailToSend = new SendEmailCommand({
    Destination: {
      ToAddresses: ["test@test.com"],
    },
    Message: {
      Body: {
        Html: {
          Data: "<html><body><p>Hello</p></body></html>",
        },
      },
      Subject: {
        Data: "test email",
      },
    },
    Source: "no-reply@test.com",
    ConfigurationSetName: "test_config_set",
  });
  //Try sending
  try {
    await ses.send(emailToSend);
    process.exit();
  } catch (err) {
    console.log(err);
    process.exit();
  }
};

send_ses();

When I run the code above, the email is sent but not through the dedicated IP. On Cloudwatch, there is no activity on the pool. My email is verified, and the Configuration Set is set to use the dedicated IP pool using Cloudwatch. And as it is managed, it doesn't need to warm up.

Is there anything I am missing to send an email through the dedicated IP pool ?


Solution

  • The code above is correct. The dedicated IP managed pool needs to warm up also. The only difference is that AWS warms up the pool for you. It takes 24 hours to start sending through the managed pool and 3-4 days to be fully warmed up