MimePart Class

Provides properties and methods for constructing a customized MIME part defined in RFC822.


[Visual Basic]
Public Class MimePart
public class MimePart
public ref class MimePart
public class MimePart

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


MimePart and MimePartCollection are the base class for generating email message. We don't suggest that the developers use these classes directly. Anyway, the MimePart and MimePartCollection can be used to generate some special email message, see the following example code.


[C# - Generate text/xml mime part]
SmtpMail oMail = new SmtpMail("TryIt");
MimePart oMimePart = new MimePart();
oMimePart.Charset = "utf-8";
oMimePart.Headers.Insert( 0, new HeaderItem( "Content-Type: text/xml;\r\n\tcharset=\"utf-8\"" ));
oMimePart.TransferEncoding = TransferEncodingType.EncodingQuotedPrintable;
oMimePart.UnencodeContent = System.Text.Encoding.UTF8.GetBytes( "<?xml version=\"1.0\" encoding=\"utf-8\" ?>..." );
oMail.MimeParts.Add( oMimePart );

await oMail.SaveAsAsync( "ms-appdata:///local/test.email", true );

' the following content will be generated.
Message-ID: <040a9d32e7846ef3323594400010770e@>
From: <>
Subject: (Trial Version)
Date: Tue, 21 Mar 2006 09:28:37 +0800
MIME-Version: 1.0
Content-Type: text/xml;
Content-Transfer-Encoding: quoted-printable

<?xml version=3D"1.0" encoding=3D"utf-8" ?>...