Sample code for 30+ languages & platforms
Xbase++

Email Body - Plain Text and/or HTML

Any given email may have a plain-text body, an HTML body, or both. The Body property will return the HTML body by default (if it exists) otherwise it will return the plain-text body. There are methods for checking to see if an email has a particular body (HasPlainTextBody and HasHtmlBody) and there are methods for getting a specific body: GetHtmlBody, GetPlainTextBody.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oEmail
LOCAL nBText
LOCAL nBHtml

nSuccess := 0

oEmail := CreateObject("Chilkat.Email")

//  Load an email from a .eml

nSuccess := oEmail:LoadEml("something.eml")
IF (nSuccess != 1)
    ? oEmail:LastErrorText
    oEmail:destroy()
    RETURN
ENDIF

//  Display the default Body:
? oEmail:Body

//  If a plain-text body is present, display it:

nBText := oEmail:HasPlainTextBody()
IF (nBText == 1)
    ? oEmail:GetPlainTextBody()
ENDIF

//  If an HTML body is present, display the HTML source:

nBHtml := oEmail:HasHtmlBody()
IF (nBHtml == 1)
    ? oEmail:GetHtmlBody()
ENDIF

oEmail:destroy()