ComponentPro UltimateMail

Extracting embedded resources

Language Filter: AllSend comments on this topic to ComponentPro

Linked resources in a mail message can either be extracted to file or stream object. The example below shows how to load a mail message and save its embedded resources to disk:

using System;
using ComponentPro.Net.Mail;


// Create a new instance of the MailMessage class.
MailMessage msg = new MailMessage();

// Extract embedded resources. 
foreach (LinkedResource lr in msg.LinkedResources)
    lr.Save("c:\\temp\\resources\\" + lr.ContentIdentifier.Id);