用socket连接163发邮件服务器:
代码
/////data数据:更换
From: test1@domain.com
To: test2@domain.com
Date: Mon, 25 Oct 2004 14:24:27 +0800
Subject: test mail
Hi, test2
This is a test mail, you don't reply it.
![](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
var ba:ByteArray = new ByteArray();
ba.writeUTFBytes("MAIL FROM: <fanxing518@163.com>\r\n");
ba.writeUTFBytes("RCPT TO: <fanxingzjy@gmail.com>\r\n");
ba.writeUTFBytes("data\r\n");
ba.writeUTFBytes("From: fanxing518@163.com\r\n");
ba.writeUTFBytes("To: fanxingzjy@gmail.com\r\n");
ba.writeUTFBytes("Subject: testSubject\r\n");
ba.writeUTFBytes("Mime-Version:1.0\r\n");
ba.writeUTFBytes("Content-Type:text/plain\r\n");
ba.writeUTFBytes("\r\n");
ba.writeUTFBytes("HELLO\r\n");
ba.writeUTFBytes(".\r\n");
socket.writeBytes(ba);
socket.flush();
ba.writeUTFBytes("MAIL FROM: <fanxing518@163.com>\r\n");
ba.writeUTFBytes("RCPT TO: <fanxingzjy@gmail.com>\r\n");
ba.writeUTFBytes("data\r\n");
ba.writeUTFBytes("From: fanxing518@163.com\r\n");
ba.writeUTFBytes("To: fanxingzjy@gmail.com\r\n");
ba.writeUTFBytes("Subject: testSubject\r\n");
ba.writeUTFBytes("Mime-Version:1.0\r\n");
ba.writeUTFBytes("Content-Type:text/plain\r\n");
ba.writeUTFBytes("\r\n");
ba.writeUTFBytes("HELLO\r\n");
ba.writeUTFBytes(".\r\n");
socket.writeBytes(ba);
socket.flush();
/////data数据:更换
From: test1@domain.com
To: test2@domain.com
Date: Mon, 25 Oct 2004 14:24:27 +0800
Subject: test mail
Hi, test2
This is a test mail, you don't reply it.