Text based attachments corrupted

Hi,

In one of our projects, Email messages with CSV (coma seperated text files) attachments are saved to disk for further processing. It turns out that all binary attachments are fine, but all text based attachments are corrupted by added newline characters.

Sample code:

For Each mailInfo In mailList
mailNumber = mailInfo.SequenceNumber
StatusText.Text = "Getting message: " & mailNumber.ToString() & "..."
Application.DoEvents()
SaveMessage(mailNumber, mailServer, userName, password)
mailMessage = MimeMessage.Load(_outputPath & mailNumber.ToString() & ".eml", MessageFormat.Eml)

For Each mailAttachment In mailMessage.Attachments
mailAttachment.Save(_outputPath & mailAttachment.Name)
Next
Next

The messages are saved using:
client.SaveMessage(msgNr, _outputPath & msgNr.ToString() & ".eml")

Now i have 2 questions:

- When using client.FetchMessage(msgNr) the attachments stay empty. Is there a way to directly download the message into memory, and save the attachments to disk?

- Is there any way to prevent the textbased attachments from getting corrupted with additional linebreaks? (other than zipping the text and attaching it)

Hope you can help.

Richard

Dear Richard,

Thanks for your post.

1. You can use SaveMessage(int sequenceNumber, Stream output) to download the message into a MemoryStream.

2. Could you please provide me a CVS file, and the EML file for debugging? I will try to fix it ASAP.

Thanks,

Dear Richard,

Could you please try this hotfix? We have fixed a bug in decoding the EML file.

Here is the hotfix, please check it out.

[http://www.aspose.com/products/aspose.network/releases/Aspose.Network3.5.2.2.zip](https://forum.aspose.com/products/aspose.network/releases/Aspose.Network3.5.2.2.zip)

Let me know, if it works.

Thanks a lot.

Hello, Richard,

Please re-download the dll for my mistakes for uploading a wrong one.

[http://www.aspose.com/products/aspose.network/releases/Aspose.Network3.5.2.3.zip](https://forum.aspose.com/products/aspose.network/releases/Aspose.Network3.5.2.3.zip)