Error: connect ECONNREFUSED 127.0.0.1:465 nodemailer

后端 未结 4 892
礼貌的吻别
礼貌的吻别 2021-01-17 14:50

I was using my gmail account to send an smtp alert messages to my users email . Example, registration or account blocked etc. I am using a nodemailer and was email were sent

4条回答
  •  滥情空心
    2021-01-17 15:21

    Thank you for your time guys. Below is what works for me .

    nodemailer.createTransport('smtps://user%myDomain.com:pass@smtp.gmail.com');
    

    changed to

    var smtpConfig = {
        host: 'smtp.gmail.com',
        port: 465,
        secure: true, // use SSL
        auth: {
            user: 'user@myDomain.com',
            pass: 'pass@pass'
        }
    };
    var transporter = nodemailer.createTransport(smtpConfig);
    

    I Found the example above on the doc https://github.com/nodemailer/nodemailer . I am suspecting this may happened to you if your password contained @ symbol considering u and the smtps link. Its therefore advisable to split it into an object without the @ symbol interfering with your smtps url. This is my guess thought. Nonetheless the above solution works for me. Plus don't forget to allow less secure apps from your google console.

提交回复
热议问题