aspNetEmail

MimeBodyPart.UrlContentBase Property

Sets the URL ContentBase header for the Mime Part.

public string UrlContentBase {get; set;}

Remarks

If the content of the part is loaded from a URL, using AppendBodyFromUrl, the ContentBase header is automatically set.

Example

[C#]
            EmailMessage msg = new EmailMessage( "mail.myCompany.com");
            msg.FromAddress = "me@myCompany.com";
            msg.To = "You@YourCompany.com";
            msg.Subject = "Requested Data";
            
            //create the plain text part
            MimeBodyPart textPart = new MimeBodyPart();
            textPart.AppendBodyFromFile( "c:\\temp\\report.txt" );
            
            //wrap the lines at 70 characters
            textPart.WordWrapLen = 70;
            
            //set the charset
            textPart.CharSet = "iso-8859-1";
            
            //create the html part
            MimeBodyPart htmlPart = new MimeBodyPart();
            htmlPart.AppendBodyFromFile( "c:\\temp\\report.htm" );
            htmlPart.BodyFormat = MailFormat.Html;
            
            //wrap the lines at 70 characters
            htmlPart.WordWrapLen = 70;
            
            //set the charset
            htmlPart.CharSet = "iso-8859-1";
            
            //set the url content base
            htmlPart.UrlContentBase = "http://www.mycompany.com";
            
            //set the content location (online location where this can be found )
            htmlPart.ContentLocation ="http://www.mycompany.com/report.htm";
            
            //add the text part first
            msg.AddMimeBodyPart( textPart );
            msg.AddMimeBodyPart( htmlPart );
            
            msg.Send(); 
            
            
[VB.NET]
            
            Dim msg As New EmailMessage("mail.myCompany.com")
            
            msg.FromAddress = "me@myCompany.com"
            msg.To = "You@YourCompany.com"
            msg.Subject = "Requested Data"
            
            'create the plain text part
            Dim textPart As New MimeBodyPart()
            textPart.AppendBodyFromFile("c:\temp\report.txt")
            
            'wrap the lines at 70 characters
            textPart.WordWrapLen = 70
            
            'set the charset
            textPart.CharSet = "iso-8859-1"
            
            'create the html part
            Dim htmlPart As New MimeBodyPart()
            htmlPart.AppendBodyFromFile("c:\temp\report.htm")
            htmlPart.BodyFormat = MailFormat.Html
            
            'wrap the lines at 70 characters
            htmlPart.WordWrapLen = 70
            
            'set the charset
            htmlPart.CharSet = "iso-8859-1"
            
            'set the url content base
            htmlPart.UrlContentBase = "http://www.mycompany.com"
            
            'set the content location (online location where this can be found )
            htmlPart.ContentLocation = "http://www.mycompany.com/report.htm"
            
            'add the text part first
            msg.AddMimeBodyPart(textPart)
            msg.AddMimeBodyPart(htmlPart)
            
            msg.Send()
            
            
            

See Also

MimeBodyPart Class | aspNetEmail Namespace