私の構造:
site
-- node_modules
---- nodemailer
-- webclient
---- js
------- controller.js
site/node_modules/nodemailer
site/webclient/js/controller.js
サイト/webclient/js/controller.js:
var nodemailer = require('../../node_modules/nodemailer');
var transport = nodemailer.createTransport('SES', {
AWSAccessKeyID: 'xxx', // real one in code
AWSSecretKey: 'xxx', // real one in code
ServiceUrl: 'email-smtp.us-west-2.amazonaws.com'
});
var message = {
from: 'example@mail.com', // verified in Amazon AWS SES
to: 'example@mail.com', // verified in Amazon AWS SES
subject: 'testing',
text: 'hello',
html: '<p><b>hello</b></p>' +
'test'
};
transport.sendMail(message, function(error) {
if (error) {
console.log(error);
} else {
console.log('Message sent: ' + response.message);
}
});
このコードは、その中の他のすべての機能が完全に機能するコントローラーの一部です。
- 足りないものはありますか?
- おそらく、間違った nodemailer モジュールを呼び出しているのでしょうか?
- または、トランスポートは SES ではなく SMTP にする必要がありますか?
私は立ち往生しています。