Mail.TextBody Property


Gets the plain/text body of the e-mail message.

[Visual Basic]
Public Property Get TextBody() As String
[Visual C++]
public: get_TextBody(BSTR* pVal);

Property Value

A String value indicating the text body of the e-mail message.

Remarks

If the email doesn't have a html body part, HtmlBody returns a html body converted from text body part; If the email doesn't have a text body part, TextBody returns a text body converted from html body.

Example

[VBScript]
Dim oMail
Set oMail = CreateObject("EAGetMailObj.Mail")
oMail.LicenseCode = "TryIt"

oMail.LoadFile "c:\\test.eml", False

WScript.Echo("text body:") 
WScript.Echo(oMail.TextBody)
WScript.Echo("html body:")
WScript.Echo(oMail.HtmlBody)


/*if the test.eml has both text and html part,

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 text body

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

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

------=MailPart0000_0010_044A2F14--


then output

text body:
this is a text body

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


if the test.eml has only text part,

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

then output

text body:
test body

html body:
test body<br>

if the test.eml has only html part,
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 html body</body></html>


then output

text body:
this is a html body

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


See Also

Mail.From Property
Mail.To Property
Mail.Cc Property
Mail.HtmlBody Property
Mail.OriginalBodyFormat Property
Mail.Attachments Property

Online Tutorials

Parse Email in VB6 - Tutorial
Parse winmail.dat(TNEF) in VB6 - Tutorial
Parse Email in Delphi - Tutorial
Parse winmail.dat(TNEF) in Delphi - Tutorial
Parse Email in VC++- Tutorial
Parse winmail.dat(TNEF) in VC++ - Tutorial