O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Retrieve E-Mail Through POP3

Problem

You want to retrieve messages from a POP3 mail server.

Solution

Create a dedicated class that sends POP3 commands over a TCP connection.

Discussion

POP3 is a common e-mail protocol used to download messages from a mail server. POP3, like many Internet protocols, defines a small set of commands that are sent as simple ASCII-encoded messages over a TCP connection (typically on port 110).

Here’s a listing of a typical POP3 dialogue, starting immediately after the client makes a TCP connection:

Server sends:+OK <22689.1039100760@mail.prosetech.com> Client sends:USER <UserName> Server sends:+OK Client sends:PASS <Password> Server sends:+OK Client sends:LIST Server sends:+OK Server sends:<Message list terminated by a period> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required