Get message's alternative body text.
[Syntax] C++: HRESULT GetAltBody( BSTR* pVal ) Visual Basic: GetAltBody() As String C#: string GetAltBody()
Return Value
This method returns message's alternative 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. GetAltBody returns TEXT/PLAIN part of an email.
Usage Example
[Visual Basic]
Sub ParseAltBody( emailFile As String )
Dim oMsg As ANPOPLib.POPMSG
Dim nRet As Integer
Dim altBody, err As String
Set oMsg = new ANPOPLib.POPMSG
nRet = oMsg.ImportFile( emailFile )
If nRet <> 0 Then
err = "error with ImportFile"
GoTo ErrorHandler
End If
If oMsg.GetBodyFormat() = 2 Then
altBody = oMsg.GetAltBody()
End If
ErrorHandler:
Set oMsg = Nothing
End Sub
[C#]
public void ParseAltBody( string emailFile )
{
POPMSGClass oMsg = new POPMSGClass();
int nRet = 0;
string altBody = "";
try
{
nRet = oMsg.ImportFile( emailFile );
if( nRet != 0 )
throw new Exception( "error with ImportFile" );
if( oMsg.GetBodyFormat() == 2 )
altBody = oMsg.GetAltBody()
}
catch( Exception e )
{
Console.WriteLine( e.Message );
}
oMsg = null;
}
See Also
GetBodyText Method
GetBodyFormat Method
2001-2007 © Copyright AdminSystem Software Limited. All rights reserved.