This project is read-only.

SAVE Message attachment to disk folder

Aug 19, 2013 at 4:24 PM
Hello Pavel...

How to save mail attachment (one or more per mail) to local folder disc?
Is there any function like mail.Save (path....) or something like that. Here is piece of sample code I want...

if (m.Attachments.Count > 0)
   foreach (var attachment in m.Attachments)
               // attachment.Save //Implement here code for saving attachment
Aug 19, 2013 at 9:39 PM
Hi vladang,

to save the attachment to a given folder you can use the method Attachment.SaveFile(string folderPath):
foreach (var attachment in m.Attachments)
Another options is accessing the property Attachment.FileData and write the byte array directly to disk.

I recommend you taking a look at the sample application, it has sample code for all major tasks.

Best regards,

Pavel Azanov
Aug 20, 2013 at 12:56 AM
Thanks Pavel. This is nice. Just another question regarding on attachments. Is it possible somehow to get URL link for some attachment, something like:


If it is possible, I can use that link outside of application, for download attachment from Gmail
Aug 20, 2013 at 12:35 PM
It is not possible to get a direct link to an attachment. So if you want to share the attachment with someone, you have to upload it somewhere yourself and share the link you get.