// Firstly you might want to use POP3Class which is mail support class.
POP3Class Pop3=new POP3Class();
pop3.DoConnect("your.mail.server",110,"username","password");
pop3.GetStat();// and then you can use the below code for storing an attachment.MailMessage mail =newMailMessage();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)return0;foreach(Attachment attachment in mail.Attachments){//Save the file Console.WriteLine("Saving '{0}' ({1}).",
attachment.FileName, attachment.MediaType);
attachment.Save(attachment.FileName);}//Hope that helps.
Ich habe nicht mit solchen Methoden und Eigenschaften in attachment Klasse, hast du einige 3rd parties libs?
//Load mail message from disk MailMessage mail =newMailMessage();
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)return0;foreach(Attachment attachment in mail.Attachments){//Save the file Console.WriteLine("Saving '{0}' ({1}).",
attachment.FileName, attachment.MediaType);
attachment.Save(attachment.FileName);}
attachment
Klasse, hast du einige 3rd parties libs?Folgende code stammt aus Extrahieren Sie Anlagen Beispiel, die kommt mit unserer Rebex Mail Komponente. Download von einem POP3-server ist in der HOWTO: Herunterladen, E-Mails von einem GMail-Konto in C# Beitrag.