This project is read-only.

Save Attachment to file

Feb 9, 2010 at 8:08 AM
Edited Feb 9, 2010 at 8:09 AM

Hi Guys,

is there any way to save an attachment to file. I get an error when trying to get the DataBinary with:

byte[] data = email.BodyParts[i].DataBinary;

The Message is: "Ungültige Zeichen in einer Base-64-Zeichenfolge."  In english its: "Invalid character in a Base-64 string"

I want save the file using:

                                    using (FileStream fs = new FileStream(destinationFilePath, FileMode.Create))
                                    {
                                        fs.Write(data, 0, size);
                                        fs.Flush();
                                        fs.Close();
                                    }
Any Ideas?
Christian