I am trying to implement a WPF application which can receive the mails sent to a specific email address. The scenario is that, the user will send a PPT file as an attachment to a specific email address, and my WPF application will listen to this email and once it receives the email, it will download the attached file and saves it to the hard drive.
I looked a bit, but all I found was that the System.Net.Mail
only supports sending emails through an application using System.Net.Mail.SmtpClient
class. Can anyone suggest me how to do this in WPF and C#.
Thanks in advance!
Attachments won't open or download If attachments won't upload or download, try these steps in order: On your computer, check that you're using a supported browser. Try turning off extensions you have on your browser one at a time. Clear your browser's cache and cookies.
1: Adobe Reader. In my opinion, Adobe Reader (Figure A) is the single most important app for opening email attachments. The vast majority of the important attachments I receive are in PDF format.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With