var net = require('net');
var SmtpClient = exports.SmtpClient =function(host,port,useSecure){
this.host = host;
this.port = port||25;
this.socket = new net.Stream();
var self = this;
this.operationing = [];
this.socket.addListener('data',function(data){
var dataStr = data.toString();
console.log(dataStr);
var msg = !/([^ ]+)$/.test(dataStr)||RegExp.$1;
var code = (dataStr.match(/^\d+/g)||[""])[0];
switch(code) {
case "250":
var operation = self.operationing.pop();
if(operation == "connect") {
self.connected = true;
self.handleEvent("connect");
} else if(operation == "from") {
self.handleEvent("from");
} else if(operation &#
用NodeJs简易实现Smtp客户端
最新推荐文章于 2021-11-15 23:19:14 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)