Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nodemailer/nodemailer
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Apr 28, 2021
2 parents 058d414 + fcb0d1f commit 0636d58
Show file tree
Hide file tree
Showing 4 changed files with 663 additions and 25 deletions.
40 changes: 24 additions & 16 deletions lib/ses-transport/index.js
Expand Up @@ -309,29 +309,37 @@ class SESTransport extends EventEmitter {
*/
verify(callback) {
let promise;
let ses = (this.ses.aws ? this.ses.ses : this.ses) || {};
let aws = this.ses.aws || {};

const sesMessage = {
RawMessage: {
// required
Data: 'From: invalid@invalid\r\nTo: invalid@invalid\r\n Subject: Invalid\r\n\r\nInvalid'
},
Source: 'invalid@invalid',
Destinations: ['invalid@invalid']
};
const cb = err => {
if (err && err.code !== 'InvalidParameterValue') {
return callback(err);
}
return callback(null, true);
};

if (!callback) {
promise = new Promise((resolve, reject) => {
callback = shared.callbackPromise(resolve, reject);
});
}

this.ses.sendRawEmail(
{
RawMessage: {
// required
Data: 'From: invalid@invalid\r\nTo: invalid@invalid\r\n Subject: Invalid\r\n\r\nInvalid'
},
Source: 'invalid@invalid',
Destinations: ['invalid@invalid']
},
err => {
if (err && err.code !== 'InvalidParameterValue') {
return callback(err);
}
return callback(null, true);
}
);
if (typeof ses.send === 'function' && aws.SendRawEmailCommand) {
// v3 API
ses.send(new aws.SendRawEmailCommand(sesMessage), cb);
} else {
// v2 API
ses.sendRawEmail(sesMessage, cb).promise();
}

return promise;
}
Expand Down
6 changes: 5 additions & 1 deletion lib/shared/index.js
Expand Up @@ -327,7 +327,11 @@ module.exports.resolveContent = (data, key, callback) => {
}
// we can't stream twice the same content, so we need
// to replace the stream object with the streaming result
data[key] = value;
if (data[key].content) {
data[key].content = value;
} else {
data[key] = value;
}
callback(null, value);
});
} else if (/^https?:\/\//i.test(content.path || content.href)) {
Expand Down

0 comments on commit 0636d58

Please sign in to comment.