GetRecipientName Method

Get specified normal recipient's friendly name.

[Syntax]
C++: HRESULT GetRecipientName( int nCount, BSTR* pVal )
Visual Basic: GetRecipientName( nCount As Integer ) As String
C#: string GetRecipientName( int nCount )

Parameters

nCount

Ordinal number of normal recipient. The minimum value is 1, the maximum value is returned by method GetRecipientCount.

Return Value

This method returns specified normal recipient's friendly name.

Remarks

If there is no normal recipient's friendly name, it returns recipient's email address.

Usage Example

[Visual C++]
#include <comdef.h>
#include <string>
#include <iostream>
using namespace std;
#import "c:\program files\adminsystem.net\anpop\anpop.dll" no_namespace

void ParseAllRecipients( LPCSTR emailFile )
{
  ::CoInitialize( NULL );
  int i = 0, nRet = 0, nCount = 0
  _bstr_t name = "", address = "";
  
  IPOPMSGPtr  oMsg("ANPOP.POPMSG");
  try
  {
    nRet = oMsg->ImportFile( emailFile );
    if( nRet != 0 )
      throw string( "error with ImportFile" );

    nCount = oMsg->GetRecipientCount(); //Parse normal recipients
    for( i = 1; i <= nCount; i++ )
    {
      name = oMsg->GetRecipientName(i);
      address = GetRecipientAddr(i); 
    }
    
    nCount = oMsg->GetCCCount(); //Parse carbon copy recipients
    for( i = 1; i <= nCount; i++ )
    {
      name = oMsg->GetCCName(i);
      address = GetCCAddr(i); 
    }
  }
  catch( string &e )
  {
    cout << e << endl;
  } 
  
  oMsg.Release();
  ::CoUninitialize();
}

See Also

GetRecipientCount Method
GetRecipientAddr Method
GetCCCount Method
GetCCName Method
GetCCAddr Method


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