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
總結
以上是生活随笔為你收集整理的C#实现监听网易邮箱的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: 货币单位有哪些
 - 下一篇: 成龙历险记符咒是第几季(成龙历险记符咒)