-1

我正在尝试使用 C# 在我的 Yahoo 帐户上检索邮件。我测试了 OpenPop 来做到这一点,我写的是

Pop3Client objClient = new Pop3Client();
objClient.Connect("pop.mail.yahoo.com", 995, true);
objClient.Authenticate("username","pass",AuthenticationMethod.UsernameAndPassword);
int msgCount = objClient.GetMessageCount();
MessageBox.Show(msgCount.ToString());

服务器始终不接受用户凭据但我确定凭据正常的问题。

我用我的 gmail 帐户尝试了相同的代码,一切正常,雅虎希望我设置它吗?

4

2 回答 2

1

为了通过电子邮件程序访问 Yahoo 邮件,您需要成为 Yahoo Mail Plus 订阅者。

1. Sign in to Yahoo Mail.
2. Move your cursor over the gear icon (Gear Icon) and select Mail Options.
3. Select POP & Forwarding.
- The "Access your Yahoo Mail elsewhere" option displays.
4. Select the radio button next to Access Yahoo Mail via POP.
5. Click Save.
于 2013-09-27T09:57:27.497 回答
0

试试下面的代码:

try
 {
    if (pop3Client.Connected)
        pop3Client.Disconnect();

    pop3Client.Connect("pop.mail.yahoo.com", 995, true);
    pop3Client.Authenticate("your@yahoo.com", "yourpassword");
    int count = pop3Client.GetMessageCount();
}
catch (InvalidLoginException)
{
   //MessageBox.Show(this, "The server did not accept the user credentials!", "POP3 Server Authentication");
}
catch (PopServerNotFoundException)
{
   //MessageBox.Show(this, "The server could not be found", "POP3 Retrieval");
}
catch (PopServerLockedException)
{
   //MessageBox.Show(this, "The mailbox is locked. It might be in use or under maintenance. Are you connected elsewhere?", "POP3 Account Locked");
}
catch (LoginDelayException)
{
   //MessageBox.Show(this, "Login not allowed. Server enforces delay between logins. Have you connected recently?", "POP3 Account Login Delay");
}
catch (Exception e)
{
   //MessageBox.Show(this, "Error occurred retrieving mail. " + e.Message, "POP3 Retrieval");
}
于 2012-06-28T12:42:29.597 回答