Used to support multipart/alternative mail support, based upon RFC 2045 - 2049. An email can consist of many different parts, for example Text, Html, or Richtext. Different readers support different formats.
For a list of all members of this type, see MimeBodyPart Members.
System.Object
MimeBodyPart
The following examples assume there is a file called news.txt and news.htm in the same directories as the compiled application.
EmailMessage msg = new EmailMessage( "mail.mycompany.com");
msg.FromAddress = "me@mycompany.com";
msg.To = "you@yourcompany.com";
msg.Subject="multi-part email";
msg.AltText = "This is a multi-part email in Mime format.";
MimeBodyPart part;
//add the text bodypart
part = new MimeBodyPart();
part.GetBodyFromFile("news.txt");
//we could have easily used
/// //part.Body ="some long string of text";
msg.AddMimeBodyPart( part );
//add the html body part
part=new MimeBodyPart();
part.GetBodyFromFile("news.htm");
//again we could have also used
//part.Body = "<p>some long text with html tags</p>";
part.BodyFormat = MailFormat.Html;
msg.AddMimeBodyPart( part );
msg.Send();
Dim msg As EmailMessage = New EmailMessage("mail.mycompany.com")
msg.FromAddress = "me@mycompany.com"
msg.To = "you@yourcompany.com"
msg.Subject = "multi-part email"
msg.AltText = "This is a multi-part email in Mime format."
Dim part As MimeBodyPart
'add the text bodypart
part = New MimeBodyPart()
part.GetBodyFromFile("news.txt")
'we could have easily used
'part.Body ="some long string of text"
msg.AddMimeBodyPart(part)
'add the html body part
part = New MimeBodyPart()
part.GetBodyFromFile("news.htm")
'again we could have also used
'part.Body = "<p>some long text with html tags</p>"
part.BodyFormat = MailFormat.Html
msg.AddMimeBodyPart(part)
msg.Send()
Namespace: aspNetEmail
Assembly: aspNetEmail (in aspNetEmail.dll)