Great assembly!
However, when implementing the assembly in a project I was working on, I was having a small problem with the attachments I was processing. Sometimes text attachments would have extra blank lines and would cause MailMessage.ParseMime() to read attempt to read past the end of the message. I think when reading the part body the method needs to read until it encounters the next boundary instead of stopping on a blank line. I would suggest trying the following patch to MailMessage.cs:
- // header body
+ // read part body - must read to the next inner boundary
data = reader.ReadLine(ref maxLength, Encoding);
var body = new StringBuilder();
- while (data != string.Empty && !data.StartsWith(bounderInner)) {
+ while (!data.StartsWith(bounderInner) && (maxLength > 0 || !maxLengthSpecified)) {
body.AppendLine(data);
data = reader.ReadLine(ref maxLength, Encoding);
}
+
I've done some limited testing and it appears to work.
Great assembly! However, when implementing the assembly in a project I was working on, I was having a small problem with the attachments I was processing. Sometimes text attachments would have extra blank lines and would cause MailMessage.ParseMime() to read attempt to read past the end of the message. I think when reading the part body the method needs to read until it encounters the next boundary instead of stopping on a blank line. I would suggest trying the following patch to MailMessage.cs:
I've done some limited testing and it appears to work.