Specifies the e-mail generates alternative text body for html body automatically.
[Visual Basic] Public Property AutoTextBody As Boolean
[C#] public bool AutoTextBody {get; set;}
[C++] public: __property bool get_AutoTextBody(); public: __property void set_AutoTextBody(bool);
[JScript] public function get AutoTextBody() : bool; public function set AutoTextBody(bool);
Property Value
Remarks
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