C#实现监听网易邮箱
作者:互联网
要用到 S22.Imap 一个开源的动态库
string host = "网易收件服务器";
int port = 993;//用的qq邮箱发的端口是993 网易的是995 监听网易邮箱要监听993端口
string username = "账号";
string password = "密码";
using (ImapClient client = new ImapClient(host, port, username, password, AuthMethod.Login, true))
{
IEnumerable<uint> uids = client.Search(SearchCondition.Unseen());
// Download mail messages from the default mailbox.
IEnumerable<MailMessage> messages = client.GetMessages(uids, FetchOptions.HtmlOnly);
foreach (var item in messages)
{
string From = item.From.ToString();
string Body = item.Body.ToString();
string Subject = item.Subject.ToString();
}
}
就是这么简单
Github地址:https://github.com/yuzd/S22.Imap
标签:string,993,C#,messages,item,client,ToString,邮箱,监听 来源: https://www.cnblogs.com/soundcode/p/15100528.html