GetBodyText Method

Get message body text.

[Syntax]
C++: HRESULT GetBodyText( BSTR* pVal )
Visual Basic: GetBodyText() As String
C#: string GetBodyText()

Return Value

Method returns message body text.

Remarks

In some case, an email consists of two bodies. One is in TEXT/HTML format, and another one is in TEXT/PLAIN format. It is called multipart/alternative format.

If BodyFormat is in TEXT/HTML format, GetBodyText returns HTML string; GetAltBody returns nothing.

If BodyFormat is in TEXT/PLAIN format, GetBodyText returns TEXT string; GetAltBody returns TEXT string too.

If BodyFormat is in MULTIPART/ALTERNATIVE format, GetBodyText return HTML string and GetAltBody returns TEXT string.

The following string will be automatically appended in message body and some texts in message body will be cut randomly if RegisterKey property is incorrect.

"ANPOP Component Build V1.0 Http://www.AdminSystem.NET"

Usage Example

[Visual Basic]
Sub ParseBodyText( emailFile As String )
  Dim oMsg As Object
  Set oMsg = CreateObject("ANPOP.POPMSG")

  Dim nRet As Integer
  Dim bodyText As String
  If  oMsg.ImportFile( emailFile ) <> 0 Then
    MsgBox "error with ImportFile" 
    Exit Sub
  End If
  
  bodyText = oMsg.GetBodyText()
End Sub
[C#]
public void ParseBodyText( string emailFile )
{
  POPMSGClass oMsg = new POPMSGClass();
  int nRet = 0;
  string bodyText = "";
  if( oMsg.ImportFile( emailFile ) != 0 )
    throw new Exception( "error with ImportFile" );
      
  bodyText = oMsg.GetBodyText();
}

See Also

RegisterKey Property
GetBodyFormat Method
GetAltBody Method


2001-2007 © Copyright AdminSystem Software Limited. All rights reserved.