How to save email attachments to local hard disk in C#
A:
This link helped me to resolve the same problem, but this has 30 day trial.
http://www.example-code.com/csharp/pop3_saveAttachments.asp
Happy coding
Ravia
2010-01-11 06:43:17
Please note this solution is commercial-component-dependent.
Moayad Mardini
2010-01-11 06:45:06
A:
After about 30 seconds with Google I found this CodeProject article for you
Chris
2010-01-11 08:34:48
+1
A:
Or you can use our freeware IMAP library for .net Read more here: http://hellowebapps.com/tecnologies-products/imapx/
Mehal
2010-02-09 11:38:44
A:
Following code is taken from Extract Attachments sample which comes with our Rebex Mail component. Downloading from a POP3 server is covered in the HOWTO: Download emails from a GMail account in C# blogpost.
// Load mail message from disk
MailMessage mail = new MailMessage ();
mail.Load (args[0]);
Console.WriteLine (
"Message contains {0} attachments.",
mail.Attachments.Count
);
// If message has no attachments, just exit
if (mail.Attachments.Count == 0)
return 0;
foreach (Attachment attachment in mail.Attachments)
{
// Save the file
Console.WriteLine ("Saving '{0}' ({1}).",
attachment.FileName, attachment.MediaType);
attachment.Save (attachment.FileName);
}
Martin Vobr
2010-07-08 18:44:35