SmtpMail.EncodedContent Property


Gets the encoded email content.

[Visual Basic]
Public Property EncodedContent As Byte()
[C#]
public byte [] EncodedContent {get;}
[C++]
public: __property <unsigned char>^ get_EncodedContent();
[JScript]
public function get EncodedContent() : Byte[];

Property Value

Gets a Byte array value indicating the encoded content of e-mail message.

Example

[C#]
SmtpMail oMail = new SmtpMail("TryIt");

oMail.HtmlBody = "<html><body>this is a test</body></html>";
oMail.TextBody = "";

Console.WriteLine(System.Text.Encoding.ASCII.GetString(oMail.EncodedContent));

//Output
/*
From: <>
Subject: (Trial Version)
Date: Thu, 23 Mar 2006 15:04:18 +0800
MIME-Version: 1.0
Content-Type: multipart/alternative;
        boundary="----=MailPart0000_0010_044A2F14"

This is a multi-part message in MIME format.

------=MailPart0000_0010_044A2F14
Content-Type: text/plain;
        charset="utf-8"
Content-Transfer-Encoding: quoted-printable

this is a test

------=MailPart0000_0010_044A2F14
Content-Type: text/html;
        charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<html><body>this is a test</body></html>

------=MailPart0000_0010_044A2F14--
*/

oMail.HtmlBody = "<html><body>this is a test</body></html>";
oMail.TextBody = "plain body text";

Console.WriteLine(System.Text.Encoding.ASCII.GetString(oMail.EncodedContent));

//Output
/*
From: <>
Subject: (Trial Version)
Date: Thu, 23 Mar 2006 15:04:18 +0800
MIME-Version: 1.0
Content-Type: multipart/alternative;
        boundary="----=MailPart0000_0010_044A2F14"

This is a multi-part message in MIME format.

------=MailPart0000_0010_044A2F14
Content-Type: text/plain;
        charset="utf-8"
Content-Transfer-Encoding: quoted-printable

plain body text

------=MailPart0000_0010_044A2F14
Content-Type: text/html;
        charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<html><body>this is a test</body></html>

------=MailPart0000_0010_044A2F14--
*/

oMail.TextBody = "test body";
oMail.HtmlBody = "";

Console.WriteLine(System.Text.Encoding.ASCII.GetString(oMail.EncodedContent));

//Output
/*
From: <>
Subject: (Trial Version)
Date: Thu, 23 Mar 2006 15:04:18 +0800
MIME-Version: 1.0
Content-Type: text/plain;
        charset="utf-8"
Content-Transfer-Encoding: quoted-printable

test body
*/

oMail.HtmlBody = "<html><body>this is a test</body></html>";
oMail.TextBody = "";
oMail.AutoTextBody = false;

Console.WriteLine(System.Text.Encoding.ASCII.GetString(oMail.EncodedContent));
//Output
/*
From: <>
Subject: (Trial Version)
Date: Thu, 23 Mar 2006 15:04:18 +0800
MIME-Version: 1.0
Content-Type: text/html;
        charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<html><body>this is a test</body></html>
*/

See Also

SmtpMail.SaveAs Method