Ari Porad
Ari Porad

Reputation: 2922

Node.js Nodemailer And SES - Error: No transport method defined

I am using nodemailer to send emails with SES. I am setting it up like this:

require("nodemailer").createTransport("SES", {
    AWSAccessKeyID: "AKIAJZFUSYQJNEX3VS2A",
    AWSSecretKey: "XXX", //real information removed
    SeviceUrl:"https://email.us-west-1.amazonaws.com"
}),

When I Send The Email I Get:

Error: No transport method defined

Any ideas as to why this is happening?

*EDIT:*Tried Both solutions, and they did not work

Upvotes: 2

Views: 4729

Answers (2)

Rohan Deshpande
Rohan Deshpande

Reputation: 3595

Your ServiceUrl is configured incorrectly. Amazon SES is only available in us-east-1 at this time. Please set ServiceUrl to https://email.us-east-1.amazonaws.com.

Also, for future reference, please do not share your AWS Secret Key. I strongly recommend that you rotate your AWS keys since they were posted earlier in your question.

Upvotes: 3

HILARUDEEN S ALLAUDEEN
HILARUDEEN S ALLAUDEEN

Reputation: 1752

You have to use your transport on sending mail. Just try as follows,

var nodemailer = require("nodemailer");
var transport = nodemailer.createTransport("SES", {
    AWSAccessKeyID: "AKIAJZFUSYQJNEX3VS2A",
    AWSSecretKey: "XXX",
    SeviceUrl:"https://email.us-west-1.amazonaws.com"
}),

//On sending mail
nodemailer.sendMail({
        transport : transport, //pass your transport
        sender : '[email protected]' ,
        to : '[email protected]',
        subject : "SUBJECT",
        html: '<p> Hello World </p>'
      })

Note: Here I assume, your transport is valid one and your key is enough permission(Network permission as well.)

Upvotes: 4

Related Questions