Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

819
Visualizações
Nodemailer SES TRANSPORT Error: TypeError: this.ses.sendRawEmail is not a function

I am trying to configure AWS SES with the help of nodemailer.
So I am following the documentation.
This is the code that they provided and that I tested:

let nodemailer = require("nodemailer");
let aws = require("@aws-sdk/client-ses");

const ses = new aws.SES({
  apiVersion: "2010-12-01",
  region: "us-west-2",
});

// create Nodemailer SES transporter
let transporter = nodemailer.createTransport({
  SES: { ses, aws },
});

// send some mail
transporter.sendMail(
  {
    // These are obviously not the actual emails I am using
    from: "configured_aws_email",
    to: "recipient_email",
    subject: "Message",
    text: "I hope this message gets sent!",
    ses: {
      // optional extra arguments for SendRawEmail
      Tags: [
        {
          Name: "tag_name",
          Value: "tag_value",
        },
      ],
    },
  },
  (err, info) => {
    console.log(
      "🚀 ~ file: transactional-email-confiig.js ~ line 36 ~ err",
      err
    );
    console.log(
      "🚀 ~ file: transactional-email-confiig.js ~ line 41 ~ info.envelope",
      info.envelope
    );
    console.log(
      "🚀 ~ file: transactional-email-confiig.js ~ line 43 ~ info.messageId",
      info.messageId
    );
  }
);

These are the versions of the required packaged I installed:

package.json

"@aws-sdk/client-ses": "^3.40.0",
"aws-sdk": "^2.1026.0",

I configured the AWS keys in the .env file:

.env

AWS_ACCESS_KEY_ID=***************
AWS_SECRET_ACCESS_KEY=*************

This is the node version:

node -v

v15.8.0

And the AWS SES email address I am using is verified:
enter image description here

But, I keep getting this error:

node_modules/nodemailer/lib/ses-transport/index.js:242
                this.ses.sendRawEmail(sesMessage, (err, data) => {
                         ^

TypeError: this.ses.sendRawEmail is not a function
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

For those using import instead of require, check that you use this:

`import aws from '@aws-sdk/client-ses';`
`import * as aws from '@aws-sdk/client-ses';`

as stated here.

about 4 years ago · Juan Pablo Isaza Relatório

0

Looks like @aws-sdk/client-ses interface doesn't have sendRawEmail method.

Try to install the older aws-sdk package:

npm i aws-sdk

And use it instead

const nodemailer = require("nodemailer");
const aws = require("aws-sdk");

const ses = new aws.SES({
  apiVersion: "2010-12-01",
  region: "us-west-2",
});

// create Nodemailer SES transporter
const transporter = nodemailer.createTransport({
  SES: { ses, aws },
});
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda