Login to POP3 server in using APOP

APOP is a secure method of logging in to a POP3 mail server. Your password is encrypted while being transmitted over the network. Not all servers support APOP. The ‘HasTimeStamp’ property usually tells that your server supports it.

// C# version

using System;
using Limilabs.Mail;
using Limilabs.Client.POP3;

class Program
{
    static void Main(string[] args)
    {
        using (Pop3 pop3 = new Pop3())
        {
            pop3.Connect("server.example.com");

            if (pop3.HasTimeStamp == true)
                pop3.LoginAPOP("user", "password");
            else
                pop3.Login("user", "password");

            // Receive all messages and display the subject
            MailBuilder builder = new MailBuilder();
            foreach (string uid in pop3.GetAll())
            {
                IMail email = builder.CreateFromEml(
                    pop3.GetMessageByUID(uid));

                Console.WriteLine("subject: {0}", email.Subject);
            }
            pop3.Close();
        }
    }
};
' VB.NET version

Imports System
Imports Limilabs.Mail
Imports Limilabs.Client.POP3

Public Module Module1
    Public Sub Main(ByVal args As String())

        Using pop3 As New Pop3()
            pop3.Connect("server.example.com")

            If pop3.HasTimeStamp = True Then
                pop3.LoginAPOP("user", "password")
            Else
                pop3.Login("user", "password")
            End If

            ' Receive all messages and display the subject
            Dim builder As New MailBuilder()
            For Each uid As String In pop3.GetAll()
                Dim email As IMail = builder.CreateFromEml( _
                    pop3.GetMessageByUID(uid))

                Console.WriteLine("subject: {0}", email.Subject)
            Next
            pop3.Close()
        End Using

    End Sub
End Module

Tags:    

Questions?

Consider using our Q&A forum for asking questions.

2 Responses to “Login to POP3 server in using APOP”

  1. Alberto Says:

    Hello,

    I connect to sever-mail of ‘virgilio’. but when i do the log-in i receive the following message :”[AUTH] POP3 access not allowed”. the user and the password are correct. I suppose that is a problem of ‘virgilio mail’.
    I repeat the sequence of command to connect to hotmail. but when i do the log- in “the mail box not be opened”

  2. Limilabs support Says:

    @Alberto

    > [AUTH] POP3 access not allowed
    Most likely you need to enable POP3 access. Please ask your administrator/service provider for details on how to do this (Maybe free accounts don’t have POP3 access enabled?).

    > “the mail box not be opened”
    Are you sure this is the exact error message you got from hotmail?
    Have you provided correct username and password?