Gets the content location of the attachment.
A string containing the attachment's content location taken from Content-Location header, or an empty string if Content-Location header is not set.
ContentLocation, if present, is typically a URL to the resource (where resource is the attachment data). Some mail clients, however, place Content-ID value in ContentLocation. Thus, if Content-ID is expected and ContentID header is missing while ContentLocation is present, MailBee uses its value as Content-ID of the resource.
This sample loads the message from .EML file and displays content location of each attachment of the message.
[C#] // To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.Mime; // The actual code (put it into a method of your class) // Load the message from file. MailMessage msg = new MailMessage(); msg.LoadMessage(@"C:\Docs\TestMail.eml"); // For every attachment... foreach (Attachment attach in msg.Attachments) { // ...show attachment content location. Console.WriteLine("The location is " + attach.ContentLocation); }
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.Mime ' The actual code (put it into a method of your class) ' Load the message from file. Dim msg As New MailMessage msg.LoadMessage("C:\Docs\TestMail.eml") ' For every attachment... For Each attach As Attachment In msg.Attachments ' ...show attachment content location. Console.WriteLine("The location is " & attach.ContentLocation) Next
Attachment Class | MailBee.Mime Namespace | ContentID | Headers