Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/38.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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 通过NodeEmailer使用webmail发送电子邮件_Node.js_Smtp_Nodemailer - Fatal编程技术网

Node.js 通过NodeEmailer使用webmail发送电子邮件

Node.js 通过NodeEmailer使用webmail发送电子邮件,node.js,smtp,nodemailer,Node.js,Smtp,Nodemailer,我使用nodemailer发送电子邮件,但它只适用于电子邮件,不适用于gmail //这是配置连接 "nodemailer" : { "host": "xxx.xxxxx.com", "port": 587, "secure":true, "auth": { "

我使用nodemailer发送电子邮件,但它只适用于电子邮件,不适用于gmail

//这是配置连接

"nodemailer" : { 
         
         "host": "xxx.xxxxx.com",
         "port": 587,
         "secure":true,
        "auth": {
        "user": "myuser.com", 
        "pass": "password"
    } ,
    "tls": {
      "rejectUnauthorized": false,
      "minVersion": "TLSv1"
       },
    "debug":true,
    "logger":true
  },
  "receivingEmail": {
    "feedbackemail" : "abcd@gmailcom",
    "contactemail" : "abcdef@gmail.com"
  }
//节点发送器配置

const transporter = nodemailer.createTransport((config["nodemailer"]));
      var mailOptions = {
                from: `${config["nodemailer"]["user"]}`,
                to: tomail,
                subject: subject ,
                text: data
              };
              transporter.verify(function(error, success) {
                if (error) {
                  console.log(error,"17");
                } else {
                  console.log("Server is ready to take our messages");
                }
              });

          transporter.sendMail(mailOptions, function(error, info){
            if (error) {
              console.log(error);
            } else {
              console.log('Email sent: ' + info.response);
          } 
        });
我正在发送电子邮件,但无法发送gmail帐户
我试过这个。。您能告诉我哪里出了错吗?

您需要对gmail帐户进行这些更改才能发送电子邮件。打开并更改它,因为某些应用程序和设备使用不太安全的登录技术,这会使您的帐户更容易受到攻击。我们建议您关闭这些应用的访问权限,如果您想使用这些应用,尽管存在风险,也可以打开访问权限

线程有一些选项,您可以尝试,如果上述解决方案不起作用,可能会有所帮助