为什么我在使用 nodemailer 时遇到这个错误?SSL23_GET_SERVER_HELLO:未知 [英] Why am I getting this error in using nodemailer ? SSL23_GET_SERVER_HELLO:unknown

查看:83
本文介绍了为什么我在使用 nodemailer 时遇到这个错误?SSL23_GET_SERVER_HELLO:未知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 nodemailer 构建通知应用程序,但不断收到此错误:

I'm building a notification application using nodemailer and I keep getting this error:

[错误:140735155404800:错误:140770FC:SSL 例程:SSL23_GET_SERVER_HELLO:未知协议:../deps/openssl/openssl/ssl/s23_clnt.c:794:]

我正在使用我的工作拥有的 smtp 服务器.我是一个 smtp 菜鸟,所以任何帮助将不胜感激.我在没有任何传输方法的情况下发送了电子邮件,但是在几封电子邮件之后,消息对象会报告我的电子邮件处于待处理状态":

I am using a smtp server my job has. I'm an smtp noob so any help would be appreciated. I have sent email without any transport method but after a few emails the message object would then report my email being put in a "pending state":

{"accepted":[],"rejected":[],"pending":[{"domain":"xxxxx.com","exchange":"xxxx.xxxx.com",...

当我尝试直接连接到主机时也会出现上述消息.

The above message occurs when I try to connect directly to the host as well.

这是我的代码:

 //import nodemailer
var nodemailer = require('nodemailer');

// create reusable transporter object using SMTP
var transporter = nodemailer.createTransport({
     host: 'chelsmtp01.karmalab.net',
    port: '25',
    secure:true,
});



//email details
var mailOptions = {
    from: 'XXX', // sender address
    to: 'XXX', // list of receivers
    subject: stitle, // Subject line
    text: message, // plaintext body
    html: message 
};

// send mail with defined transport object
transporter.sendMail(mailOptions, function(error, info){
    if(error)
        return console.log(error);

    console.log('Message sent: ' + JSON.stringify(info));

    //transporter.close();
});

我尝试将安全设置为 false,然后即使我像其他论坛提到的那样将 requireTLS 设置为 true,我也会收到无效的问候错误:

I have tried setting secure to false and then I get an invalid greeting error even if I set requireTLS true like some other forums have mentioned:

[Error: Invalid greeting from server:
554 chelmtp02.karmalab.net: 554 chelmtp02.karmalab.net]
code: 'EPROTOCOL',
response: '554 chelmtp02.karmalab.net',
responseCode: 554 }

SMPT 服务器不需要用户/密码

The SMPT server does not need user/password

我可以在没有在我的家庭网络上定义传输的情况下发送电子邮件.我也设法让我的 gmail 工作.可能是证书或网络问题

I can send email without a transport defined on my home network. I also managed to get my gmail to work as well. Could be a certificate or network issue

推荐答案

如果连接到端口 25,请在配置选项中使用 secure:false.使用 true 表示您要启动 TLS 连接,但端口 25 以明文形式开始,并且稍后升级

Use secure:false in the configuration options if connecting to port 25. Using true indicates that you want to start a TLS connection but port 25 starts out as plaintext and gets upgraded later

这篇关于为什么我在使用 nodemailer 时遇到这个错误?SSL23_GET_SERVER_HELLO:未知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆