npm node mailer を使用してメールを送信しているときに、受信者エラー: メールを送信できません - 受信者が定義されていないというエラーが発生します。ドキュメントのように例を調べています。私の本当の電子メールで abc@gmail.com を検討してください。
var emailAddress = "abc@gmail.com";
mailOptions = {
from: "Admin <abc@gmail.com>", // sender address
to: emailAddress, // list of receivers
subject: "Hello", // Subject line
text: "hello", // plaintext body
html: "<b>Hello</b>" // html body
}
smtpTransport = nodeMailer.createTransport("SMTP",{
service: "Gmail",
auth: {
user: "abc@gmail.com",
pass: "123"
}
});
smtpTransport.sendMail(mailJson, function(error, response){
if(error){
console.log(error);
}else{
console.log("Message sent: " + response.message);
}
// if you don't want to use this transport object anymore, uncomment following line
smtpTransport.close(); // shut down the connection pool, no more messages
});