日期:2014-05-18 浏览次数:21133 次
TcpClient tcpClient = new TcpClient("接收邮件服务器", 端口号);
NetworkStream ns = tcpClient.GetStream();
StreamReader sr = new StreamReader(ns);
sr.ReadLine();
byte[] outbytes = System.Text.Encoding.ASCII.GetBytes("USER " + "用户名" + "\r\n");
ns.Write(outbytes, 0, outbytes.Length);
string info = sr.ReadLine();
outbytes = System.Text.Encoding.ASCII.GetBytes("PASS " + "密码" + "\r\n");
ns.Write(outbytes, 0, outbytes.Length);
info = sr.ReadLine();
outbytes = System.Text.Encoding.ASCII.GetBytes("RETR " + "1" + "\r\n");//获取第一份邮件
ns.Write(outbytes, 0, outbytes.Length);
info = sr.ReadToEnd();
outbytes = System.Text.Encoding.ASCII.GetBytes("QUIT"+"\r\n");//退出
ns.Write(outbytes, 0, outbytes.Length);
info = sr.ReadLine();
------解决方案--------------------
.NET中封装了发信的功能,但是要想首先就需要操作Socket这类比较底层的方法了。
------解决方案--------------------
可用TCP UDP 接收完邮件类容 不难。
解析附件 还原 文件才难:
http://blog.csdn.net/wgsnet/archive/2005/12/19/556054.aspx
------解决方案--------------------
没写过 学习了
------解决方案--------------------
解析主要是邮件的格式,还有附件,以及编码
------解决方案--------------------
我也学习下,帮顶了
------解决方案--------------------
路过,看看,学习