Node.js 节点js电子邮件无效发件人
配置:Ubuntu 16.04 LTS/Nginx 我正在尝试使用nodemail发送邮件,但出现以下错误:Node.js 节点js电子邮件无效发件人,node.js,email,Node.js,Email,配置:Ubuntu 16.04 LTS/Nginx 我正在尝试使用nodemail发送邮件,但出现以下错误: { [Error: Invalid sender "contact@example.com>"] code: 'EENVELOPE', command: 'API' } 这是我的密码 var transporter = nodemailer.createTransport( smtpTransport('smtps://contact%40example.
{ [Error: Invalid sender "contact@example.com>"] code: 'EENVELOPE', command: 'API' }
这是我的密码
var transporter = nodemailer.createTransport(
smtpTransport('smtps://contact%40example.com:mypassword@smtp.example.com')
);
var text = 'Hello world from \n\n' + req.body.name;
var mailOptions = {
from: 'contact@example.com>', // sender address
to: 'address@gmail.com', // list of receivers
subject: 'Email Example', // Subject line
text: text //, // plaintext body
// html: '<b>Hello world ✔</b>' // You can choose to send an HTML body instead
};
transporter.sendMail(mailOptions, function(error, info){
if(error){
console.log(error);
res.json({yo: 'error'});
}else{
console.log('Message sent: ' + info.response);
res.json({yo: info.response});
};
});
var transporter=nodeEmailer.createTransport(
smtpTransport('smtps://contact%40example.com:mypassword@smtp.example.com')
);
var text='Hello world from\n\n'+req.body.name;
var mailpoptions={
发件人:'contact@example.com>“,//发件人地址
致:'address@gmail.com“,//接收者列表
主题:'电子邮件示例',//主题行
text:text//,//纯文本正文
//你好,世界✔' // 您可以选择发送HTML正文
};
transporter.sendMail(邮件选项,函数(错误,信息){
如果(错误){
console.log(错误);
res.json({yo:'error'});
}否则{
console.log('发送的消息:'+信息响应);
res.json({yo:info.response});
};
});
使用服务器上的postfix,我的邮件工作正常,我可以向gmail地址发送电子邮件,但使用node js,我会出现此错误。from:'contact@example.com>’,我比symbol>有99%的把握对此负责。您的电子邮件无效,这就是您出错的原因。改变contact@example.com>到contact@example.com所有这些都应该是有效的。希望这有帮助。天哪,杀了我。非常感谢,伙计,我也做了同样的事,谢谢