最近我要做一个爬虫。这个爬虫需要如下几个步骤:
1 填写注册内容(需要邮箱注册)
2 过拖拽验证码(geetest)
3 注册成功会给邮箱发一封确认邮箱
4 点击确认邮箱中的链接 完成注册
我这里就采用163邮箱注册。
邮箱协议有 pop3 和 imap 和 smtp
我试了pop3 不能够筛选邮件 例如筛选未读 和 发件人这2个条件 所以放弃用pop3
imap协议是支持的。
我就找了一个开源的第三方lib:S22.Imap
用法很简单:
public void Test163()
{
var imapServer = "imap.163.com";
var port = 993;
using (ImapClient client = new ImapClient(imapServer, port, "xxxx@163.com", "pwd", AuthMethod.Login, true))
{
// Returns a collection of identifiers of all mails matching the specified search criteria.
IEnumerable uids = client.Search(SearchCondition.Unseen());
// Download mail messages from the default mailbox.
IEnumerable messages = client.GetMessages(uids,FetchOptions.HtmlOnly);
Console.WriteLin