VS.NET 2010 Users Click Here   

HOMECONTACT PRODUCTS DOWNLOADS PURCHASE TESTIMONIALS FORUMS COMPANY CONTACT
Home
Products
Downloads
Purchase
Licensing
Licensing FAQ
Software Updates
Support Forums
Testimonials
Feature Requests
Guarantee
About Us
Contact Us
Hosting Companies
Privacy Policy
   
Shopping Cart


Search

aspNetMime: Handling InLine Parts

by Dave 25. November 2011 06:21

Every few months, I get a question from a developer about aspNetMime not properly finding all the attachments in an email.

Almost all of the time, these attachments are actually In-Line parts. Rather than sending files as attachments, some mail clients will actually sent these 'attachments' as In-Line parts.

To reference these parts, use the MimeMessage.InLineParts collection. Another way to reference all attachments and in-line parts is too call the MimeMessageAttachmentInLineParts() method. This method will find every attachment + in-line part. Below is a code example to demonstrate this functionality.

 

string path = "c:\\temp\\sample.eml";
MimeMessage m = MimeMessage.ParseFile( path );

//get attachments and in-line parts
MimePartCollection mpc = m.AttachmentInLineParts();
Response.Write( "total parts: " + m.RetrieveAllParts().Count.ToString

//loop through the attachments+in-line parts, write out the name
foreach( MimePart mp in mpc)
{
	Response.Write( mp.AttachmentName() );
}



As always, if anyone has any questions, feel free to email me using the Contact Us page.

Thanks,
Dave Wanta

Tags:

aspNetMime



 

 

Testimonial

Amazing service. The very few bugs were fixed within a day or two. "

M. Lavie | Mintmark Ltd

Read more testimonials
ListNanny aspNetDNS aspNetEmail aspNetPOP3 aspNetMX aspNetMIME aspNetPING aspNetTraceRoute aspNetIMAP aspNetMHT