因为只有用户帐号,没有密码,所以不能通过Login的方式来获取用户邮件信息。
通过Login的方式,大致方法如下:
Chilkat.Imap imap = new Chilkat.Imap();
bool success;
// Anything unlocks the component and begins a fully-functional 30-day trial.
success = imap.UnlockComponent("Licensing");
if (success != true)
return "Error";
// Connect to an IMAP server.
success = imap.Connect("xxxxxserver");//125.91.253.46
imap.Port = 143;
if (success != true)
return "Error";
// Login
success = imap.Login(usernumber, passwd);//用户名与密码登陆
if (success != true)
return "Error"; // Select an IMAP mailbox
success = imap.SelectMailbox("INBOX");
if (success != true)
return "Error";
Chilkat.MessageSet messageSet;
// We can choose to fetch UIDs or sequence numbers.
bool fetchUids = true;
// Get the message IDs of all the emails in the mailbox
messageSet = imap.Search("UNSEEN", fetchUids);//ALL,NEW,SEEN,UNSEEN
if (messageSet == null)
return "Error";
// Fetch the emails into a bundle object:
Chilkat.EmailBundle bundle;
bundle = imap.FetchHeaders(messageSet);//FetchBundle
if (bundle == null)
return "Error";
// Loop over the bundle and display the FROM and SUBJECT of each.
// Disconnect from the IMAP server.
imap.Disconnect();----------
以上方法是可以通过的。但现在没有密码,请问如何通过imap获取用户邮件?
通过Login的方式,大致方法如下:
Chilkat.Imap imap = new Chilkat.Imap();
bool success;
// Anything unlocks the component and begins a fully-functional 30-day trial.
success = imap.UnlockComponent("Licensing");
if (success != true)
return "Error";
// Connect to an IMAP server.
success = imap.Connect("xxxxxserver");//125.91.253.46
imap.Port = 143;
if (success != true)
return "Error";
// Login
success = imap.Login(usernumber, passwd);//用户名与密码登陆
if (success != true)
return "Error"; // Select an IMAP mailbox
success = imap.SelectMailbox("INBOX");
if (success != true)
return "Error";
Chilkat.MessageSet messageSet;
// We can choose to fetch UIDs or sequence numbers.
bool fetchUids = true;
// Get the message IDs of all the emails in the mailbox
messageSet = imap.Search("UNSEEN", fetchUids);//ALL,NEW,SEEN,UNSEEN
if (messageSet == null)
return "Error";
// Fetch the emails into a bundle object:
Chilkat.EmailBundle bundle;
bundle = imap.FetchHeaders(messageSet);//FetchBundle
if (bundle == null)
return "Error";
// Loop over the bundle and display the FROM and SUBJECT of each.
// Disconnect from the IMAP server.
imap.Disconnect();----------
以上方法是可以通过的。但现在没有密码,请问如何通过imap获取用户邮件?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货