来自优快云的 OnlyUx()
//-------------------------从name1@163.com里取出邮件------------------
Label1->Caption="正在连接服务器...";
if(NMPOP31->Connected)NMPOP31->Disconnect();
NMPOP31->AttachFilePath = ".";
NMPOP31->DeleteOnRead = false;
NMPOP31->ReportLevel = Status_Basic;
NMPOP31->TimeOut = 20000;
NMPOP31->Host ="Pop3.163.com";
NMPOP31->Port=110;
NMPOP31->UserID ="name2";
NMPOP31->Password ="密码";
NMPOP31->Connect();
Label1->Caption="连接服务器成功,读取中,请稍后...";
if(NMPOP31->MailCount)
{
ListView1->Clear();
str=NMPOP31->MailCount;
for(int i=1;i<=NMPOP31->MailCount;i++)
{
NMPOP31->GetMailMessage(i);
TListItem *listitem;
listitem=ListView1->Items->Add();
listitem->Caption=NMPOP31->MailMessage->From;
listitem->SubItems->Add(NMPOP31->MailMessage->Subject);
listitem->SubItems->Add(NMPOP31->MailMessage->Body);
}
Label1->Caption="读取完成,相关信息"+str+"条";
NMPOP31->Disconnect();
Memo1->Clear();
}
else
{
Label1->Caption="暂时没有邮件";
return;
}
}