How to POP3 in C#

Removing Messages

Retrieving a message does not remove the message from the POP3 server. A further call to LIST will still return the message. To remove a message from POP3 server, you have to call the Delete method.

public void Delete(Pop3Message rhs)
{
    string message;
    string response;

    message = "DELE " + rhs.number + "\r\n";
    Write(message);
    response = Response();
    if (response.Substring(0, 3) != "+OK")
    {
        throw new Pop3Exception(response);
    }
}

The Delete method sends a DELE message with the message number to the POP3 server. The server will respond with the +OK acknowledgment message, if successful.

You might also like...

Comments

About the author

Randy Charles Morin

Randy Charles Morin Canada

Randy's article are Copyright 1998-2003 Randy Charles Morin

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Nine people can't make a baby in a month.” - Fred Brooks