While there are no API's in the BCL for downloading emails, only sending, there is a very well regarded that is now the Microsoft recommended library for sending and receiving email, it supports POP3, IMAP, SMTP. https://github.com/jstedfast/MailKit
detects attached files and detaches them to a folder for processing
I'm going to assume you mean download a file to a directory. Fortunately with MailKit this is very easy to do, and the author of the library has written an example here: https://stackoverflow.com/a/36229918/2595033
(code taken from link)
foreach (var attachment in message.Attachments) {
using (var stream = File.Create ("fileName")) {
if (attachment is MessagePart) {
var part = (MessagePart) attachment;
part.Message.WriteTo (stream);
} else {
var part = (MimePart) attachment;
part.ContentObject.DecodeTo (stream);
}
}
}
The application will run as a service.
This is also very easy to do, you need to write a Windows Service. There's plenty of resources regarding writing one in C#. There's also a template for it in Visual Studio.
