SMTP连接

编程入门 行业动态 更新时间:2024-10-10 17:28:08

<a href=https://www.elefans.com/category/jswz/34/1770653.html style=SMTP连接"/>

SMTP连接

我正在尝试通过smtp发送邮件,但我无法这样做。它给了我连接错误

 { Error: connect EACCES xx.xxx.xx.xx:25
 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1117:14)
  errno: 'EACCES',
  code: 'ECONNECTION',
  syscall: 'connect',
  address: 'xx.xxx.xx.xx',
  port: 25,
  command: 'CONN' }

虽然我正在传递的配置是正确的,因为我正在另一个项目中传递相同的配置。

这两个项目可能在不同的服务器上,您能以同样的方式指导我吗。我被困了两天]

这里是配置以供参考

var transport = nodemailer.createTransport( {
            debug: true,
            host: "smtp.xx.xxx",
            port: 25,
            secure: false,
            auth: {
                user: 'xxxxxxxx',
                pass:'xxxxxxxxx'
            },
            tls: {
                rejectUnauthorized: false,
            }
        } );
        transport.verify(function (error, success) {
            if (error) {
                console.log('====>' + error);
            } else if (success) {
                console.log("Server is ready to take our messages");
            }
        });
    

我正在尝试通过smtp发送邮件,但我无法这样做。它给了我连接错误{错误:在TCPConnectWrap.afterConnect上连接EACCES xx.xxx.xx.xx:25 [完成时](net.js:1117:14)...

回答如下:
var transport = nodemailer.createTransport( {
        debug: true,
        host: "smtp.xx.xxx",
        port: 25,
        secure: false,
        tls: {
            rejectUnauthorized: false,
        }
    } );
    transport.verify(function (error, success) {
        if (error) {
            console.log('====>' + error);
        } else if (success) {
            console.log("Server is ready to take our messages");
        }
    });

更多推荐

SMTP连接

本文发布于:2024-05-07 10:52:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1755906.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:SMTP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!