我如何阅读电子邮件的正文? [英] How do I read the body of an email?
本文介绍了我如何阅读电子邮件的正文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望用户通过电子邮件将他们的姓名,地址和身份证号码发送到我的网络应用程序。
我需要一些建议如何实现这一点。
感谢
I want users to email their name, surname, address and id number to my web application.
I need some advise how to achieve this.
Thanks
推荐答案
using System.IO;
using System.Net.NetworkInformation;
using System.Net.Security;
using System.Net.Sockets;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// create an instance of TcpClient
TcpClient tcpclient = new TcpClient();
tcpclient.Connect("pop3.live.com", 995);
System.Net.Security.SslStream sslstream = new SslStream(tcpclient.GetStream());
sslstream.AuthenticateAsClient("pop3.live.com");
StreamWriter sw = new StreamWriter(sslstream);
System.IO.StreamReader reader = new StreamReader(sslstream);
sw.WriteLine("USER xxx@live.com"); sw.Flush();
<br/> sw.WriteLine("PASS xxxx****"); sw.Flush();
sw.WriteLine("RETR 1");
sw.Flush();
sw.WriteLine("Quit ");
sw.Flush();
string str = string.Empty;
string strTemp = string.Empty;
while ((strTemp = reader.ReadLine()) != null){
if (".".Equals(strTemp)){
break;
}
if (strTemp.IndexOf("-ERR") != -1){
break;
}
str += strTemp;
}
Response.Write(str);
reader.Close();
sw.Close();
tcpclient.Close(); // close the connection
}
}
而不是看:stackoverflow [< a href =http://stackoverflow.com/questions/13119653/how-to-read-the-body-of-the-message-in-the-mail-retrieve-from-gmail-by-using-pop target =_ blanktitle =New Window> ^ ]和 MSDN [ ^ ]
尝试
http://www.aspsnippets.com/Articles/Fetch-and-Read-emails-from-POP3-mail-serv er-using-C-and-VB.Net --- Part-I.aspx [ ^ ]
如果您有任何具体问题,请退回。
Try
http://www.aspsnippets.com/Articles/Fetch-and-Read-emails-from-POP3-mail-server-using-C-and-VB.Net---Part-I.aspx[^]
and revert back if you have any specific question.
这篇关于我如何阅读电子邮件的正文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文