Nodemailer 使用代理发送信件

问题描述 投票:0回答:1

我无法使用经过身份验证的代理通过 Nodemailer 发送电子邮件。错误:Socks5 代理拒绝连接 - ConnectionRefused。如果我不使用代理,一切正常。代码(当然我的数据是有效的):

const nodemailer = require('nodemailer');

let transporter = nodemailer.createTransport({
    host: 'smtp.gmail.com',
    port: 465,
    secure: true, // true для порта 465, false для других портов
    auth: {
        user: '[email protected]',
        pass: 'zzxxcc'
    },
    proxy: 'socks://user:[email protected]:5555'
});

transporter.set('proxy_socks_module', require('socks'));

let mailOptions = {
  from: "[email protected]",
  to: "[email protected]",
  subject: "theme",
  text: "hi"
};

transporter.sendMail(mailOptions, (error, info) => {
    if (error) {
        ended = error.message;
        resolve()
    } else {
        ended = 1;
        resolve()
    }
});

错误:Socks5 代理拒绝连接 - ConnectionRefused

node.js proxy nodemailer socks
1个回答
0
投票

const 传输器 = nodemailer.createTransport({ 服务:“gmail”, 授权:{ 用户:'###########', 经过: '###########' } });

常量信息=等待transporter.sendMail({ 来自:

[email protected]
, to:
${email}
, // 接收者列表 subject:
Hello ${email}
, // 主题行 text:
Hello ${email}
, // 纯文本正文 html:
<h1>Product You Buy From SampleCreate</h1><br><h2>your buy product are</h2> <p>${data}</p> <br> <h3>Thanks ${email} for shooping with Us</h3>
, // html 正文 });

© www.soinside.com 2019 - 2024. All rights reserved.