Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 获得;Gmail无法';t验证mydomain.com是否真的发送了此消息(而不是垃圾邮件发送者)";使用NodeEmailer发送电子邮件时的消息_Node.js_Gmail_Nodemailer - Fatal编程技术网

Node.js 获得;Gmail无法';t验证mydomain.com是否真的发送了此消息(而不是垃圾邮件发送者)";使用NodeEmailer发送电子邮件时的消息

Node.js 获得;Gmail无法';t验证mydomain.com是否真的发送了此消息(而不是垃圾邮件发送者)";使用NodeEmailer发送电子邮件时的消息,node.js,gmail,nodemailer,Node.js,Gmail,Nodemailer,我正在尝试使用nodemailer发送电子邮件 let transporter = nodemailer.createTransport({ host: 'mail.hover.com', port: 465, secure: true, // true for 465, false for other ports auth: { user: 'myemail@mydomain.com', pass: 'password',

我正在尝试使用nodemailer发送电子邮件

  let transporter = nodemailer.createTransport({
    host: 'mail.hover.com',
    port: 465,
    secure: true, // true for 465, false for other ports
    auth: {
      user: 'myemail@mydomain.com', 
      pass: 'password', 
    },
  });

  // send mail with defined transport object
  let info = await transporter.sendMail({
    from: {
      name: 'My name',
      address: 'myemail@mydomain.com',
    }, // sender address
    replyTo: 'myemail@mydomain.com',
    to: 'recipient@gmail.com', // list of receivers
    subject: 'Hello ✔', // Subject line
    text: 'Hello world?', // plain text body
    html: '<b>Hello world?</b>', // html body
  });
let transporter=nodeEmailer.createTransport({
主机:“mail.hover.com”,
港口:465,
安全:true,//对于465为true,对于其他端口为false
认证:{
用户:'myemail@mydomain.com', 
pass:'密码',
},
});
//使用定义的传输对象发送邮件
let info=wait transporter.sendMail({
发件人:{
姓名:'我的名字',
地址:'myemail@mydomain.com',
},//发件人地址
答复:'myemail@mydomain.com',
致:'recipient@gmail.com“,//接收者列表
主题:“你好✔', // 主题行
text:“Hello world?”,//纯文本正文
html:‘你好,世界?’,//html正文
});
这会按预期发送电子邮件,但Gmail会发出警告,“Gmail无法验证mydomain.com是否确实发送了此邮件(而不是垃圾邮件发送者)”。我想知道是否有一种方式可以让Gmail知道这一点myemail@mydomain.com实际上我发了电子邮件


谢谢

找到了解决办法。我基本上允许从我的自定义电子邮件发送来自我的电子邮件。我跟随导游来到这里:

  • 打开Gmail

  • 在右上角,单击设置,然后查看所有设置

  • 单击“帐户和导入”或“帐户”选项卡

  • 在“发送邮件为”部分,单击添加其他电子邮件地址

  • 输入您的姓名和发送地址(我的自定义电子邮件)

  • 单击下一步,然后发送验证

  • 对于SMTP服务器,我放置mail.hover.com(因为我正在使用它)

  • 登录到我的自定义域并单击验证链接

  • 使用nodeEmailer发送电子邮件

    let transporter = nodemailer.createTransport({
        host: 'smtp.gmail.com',
        port: 465,
        secure: true,
        auth: {
          user: 'mygmailuser@gmail.com', 
          pass: 'password', 
        },
      });
    let info = await transporter.sendMail({
        from: {
          name: 'My name',
          address: 'myemail@mydomain.com',
        },
        to: 'recipient@gmail.com', 
        subject: 'Hello ✔', 
        text: 'Hello world?', 
        html: '<b>Hello world?</b>',
      });
    
    let transporter=nodeEmailer.createTransport({
    主机:“smtp.gmail.com”,
    港口:465,
    安全:是的,
    认证:{
    用户:'mygmailuser@gmail.com', 
    pass:'密码',
    },
    });
    let info=wait transporter.sendMail({
    发件人:{
    姓名:'我的名字',
    地址:'myemail@mydomain.com',
    },
    致:'recipient@gmail.com', 
    主题:“你好✔', 
    文字:“你好,世界?”,
    html:“世界你好吗?”,
    });
    

  • 您是否为域配置了DKIM记录?域的DNS区域记录可能会在解决此问题中发挥作用。我没有使用NodeEmailer软件包,只是一个猜测。