Receiving email and downloading attachment through a C# Application

var client = new POPClient();
client.Connect("pop.gmail.com", 995, true);
client.Authenticate("[email protected]", "YourPasswordHere");
var count = client.GetMessageCount();
Message message = client.GetMessage(count);
Console.WriteLine(message.Headers.Subject);

A simple tip, that you can follow: https://joshwright.com/tips/tips-sending-receiving-email-in-csharp/


Since the various links in the other answers don't work anymore, here are 2 links to articles I wrote on CodeProject how to download emails received from POP3 servers like Gmail:

POP3 Email Client
POP3 Email Client with full MIME Support

The code has been downloaded over 10000 times, but is too big to be posted here.

Tags:

C#

.Net

Email

Wpf

Smtp