を働いていない、私はAmazonWebService(AWS)を使用する初心者だが、私の場合、私は電子メールの使用AWS SESはAWS SES実際
をNode.jsのIを送信するためのNode.jsでいくつかのプログラムを作成する必要があります電子メールを送信すべてのAWS SESのドキュメントを読んでいましたが、私は本当に理解していません。いくつかのブログはチュートリアルを書いて、私は彼らのコードに従っていたが、私のコードではそれは仕事をしなかった。
私が書いた2つのサンプルコードがあります。ここで最初のコード:
var nodemailer = require('nodemailer');
var ses = require('nodemailer-ses-transport');
var transporter = nodemailer.createTransport(ses({
accessKeyId: 'xxxxxxxxxxxxxxxxxxx',
secretAccessKey: 'xxxxxxxxxxxxxxxxxxxxxxxxx'
}));
transporter.sendMail({
from: '[email protected]',
to: '[email protected]',
subject: 'My Amazon SES Simple Email',
text: 'Amazon SES is cool'
});
は、上記の本http://budiirawan.com/send-emails-using-amazon-ses-and-node-js/
からコードreferrenceであり、第二は、このようなものです:
var aws = require('aws-sdk');
var ses = new aws.SES({
accessKeyId: 'xxxxxxxxxxxxxxxxxxx',
secretAccesskey: 'xxxxxxxxxxxxxxxxxxxxxxxx',
region: 'us-west-2'
});
// send to list
var to = ['[email protected]'];
// this must relate to a verified SES account
var from = '[email protected]';
// this sends the email
// @todo - add HTML version
ses.sendEmail({
Source: from,
Destination: { ToAddresses: to },
Message: {
Subject: {
Data: 'A Message To You'
},
Body: {
Text: {
Data: 'Stop your messing around',
}
}
}
}
, function(err, data) {
if(err) throw err
console.log('Email sent:');
console.log(data);
});
http://timstermatic.github.io/blog/2013/08/14/sending-emails-with-node-dot-js-and-amazon-ses/から第2の符号referrence。 第二のコードは私にエラーメッセージを与える:全く
C:\xampp\htdocs\mail\node_modules\aws-sdk\lib\request.js:31
throw err;
^
Error: connect ENETUNREACH :80
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)
does'nt仕事の両方を、私は私のAWSアクセスキーが正しいと私の[email protected]は、AWS SESによって検証されていたことを確認しました。私は誰かがこの問題を解決できるかどうか非常にappriciateです。