Get detailed information of a delivery report.
[Visual Basic 6.0] Public Function GetReport( _ ) As MailReport
[Visual C++] public: HRESULT GetReport( IMailReport** pVal );
Return Value
Example
[Visual Basic 6.0, VBScript, Visual C++] The following example demonstrates how to parse the delivery report with EAGetMail POP3 & IMAP4 ActiveX Object. To get the full samples of EAGetMail, please refer to Samples section.
[Visual Basic 6.0]
Private Sub ParseReport(emlFile As String)
Const FailureReport = 0
Const DeliveryReceipt = 1
Const ReadReceipt = 2
Dim oMail As New EAGetMailObjLib.Mail
oMail.LicenseCode = "TryIt"
oMail.LoadFile emlFile, False
If Not oMail.IsReport Then
MsgBox "this is not a report"
Exit Sub
End If
Dim oReport As EAGetMailObjLib.MailReport
Set oReport = oMail.GetReport()
//get report type
Select Case oReport.ReportType
Case DeliveryReceipt
MsgBox "This is a deliver receipt"
Case ReadReceipt
MsgBox "This is a read receipt"
Case Else
MsgBox "This is a failure report"
End Select
//get original message information
MsgBox oReport.OriginalSender
MsgBox oReport.OriginalRecipient
MsgBox oReport.OriginalMessageID
If oReport.ReportType = FailureReport Then
MsgBox oReport.ErrCode
MsgBox oReport.ErrDescription
End If
End Sub
[VBScript]
Sub ParseReport( emlFile )
Const FailureReport = 0
Const DeliveryReceipt = 1
Const ReadReceipt = 2
Dim oMail
Set oMail = CreateObject("EAGetMailObj.Mail")
oMail.LicenseCode = "TryIt"
oMail.LoadFile emlFile, False
If Not oMail.IsReport Then
MsgBox "this is not a report"
Exit Sub
End If
Dim oReport
Set oReport = oMail.GetReport()
//get report type
Select Case oReport.ReportType
Case DeliveryReceipt
MsgBox "This is a deliver receipt"
Case ReadReceipt
MsgBox "This is a read receipt"
Case Else
MsgBox "This is a failure report"
End Select
//get original message information
MsgBox oReport.OriginalSender
MsgBox oReport.OriginalRecipient
MsgBox oReport.OriginalMessageID
If oReport.ReportType = FailureReport Then
MsgBox oReport.ErrCode
MsgBox oReport.ErrDescription
End If
End Sub
[Visual C++]
#include "eagetmailobj.tlh"
using namespace EAGetMailObjLib;
void ParseReport( LPCTSTR lpszEmlFile )
{
const int FailureReport = 0;
const int DeliveryReceipt = 1;
const int ReadReceipt = 2;
IMailPtr oMail;
oMail.CreateInstance( "EAGetMailObj.Mail" );
oMail->LicenseCode = _T("TryIt");
oMail->LoadFile( lpszEmlFile, VARIANT_FALSE );
if( oMail->IsReport == VARIANT_FALSE )
{
::MessageBox( NULL, _T("This is not a report"), NULL, MB_OK );
return;
}
//get report type
IMailReportPtr oReport = oMail->GetReport();
switch( oReport->ReportType )
{
case DeliveryReceipt:
::MessageBox( NULL, _T("This is a delivery receipt"), NULL, MB_OK );
break;
case ReadReceipt:
::MessageBox( NULL, _T("This is a read receipt"), NULL, MB_OK );
break;
default:
::MessageBox( NULL, _T("This is a failure delivery report"), NULL, MB_OK );
break;
}
//get original message information
::MessageBox( NULL, (TCHAR*)oReport->OriginalSender, NULL, MB_OK );
::MessageBox( NULL, (TCHAR*)oReport->OriginalRecipient, NULL, MB_OK );
::MessageBox( NULL, (TCHAR*)oReport->OriginalMessageID, NULL, MB_OK );
if( oReport->ReportType == FailureReport )
{
::MessageBox( NULL, (TCHAR*)oReport->ErrCode, NULL, MB_OK );
::MessageBox( NULL, (TCHAR*)oReport->ErrDescription, NULL, MB_OK );
}
}