MimeMailMessageConverter.cs - multipart attachments not added


2 minor changes to ProcessEntities for the AttachmentMimeEntity case:
  • made "file" optional in the regex:
                Regex r = new Regex(@"(file)?name=\x22(?<Name>.*?)\x22");
  • the attachments weren't actually getting attached to the mailMessage. Added:

file attachments

Closed Apr 5, 2009 at 5:38 PM by house_air
Thanks pkuykendall and doowb. I adopted your changes.


doowb wrote Jan 29, 2009 at 1:14 AM

Also, the attachment ContentType is not being populated after creating the attachment...
attachment.ContentType = contentType;

pkuykendall wrote Jan 30, 2009 at 6:11 PM

found empty AttachmentMimeEntities were getting added.

Added test for name.length>0 before the attachment.add.

if (name.Length>0)
                    IAttachment attachment = new Attachment(name, (entity as AttachmentMimeEntity).GetContent(), contentTransferEncoding);

wrote Apr 5, 2009 at 5:38 PM

wrote Feb 13, 2013 at 2:16 AM

wrote May 14, 2013 at 8:43 PM