ashu139
Joined: 03 Sep 2009
Posts: 1
|
Posted:
Thu Sep 03, 2009 11:19 am Post subject:
Changing recipient list using protocol event sink |
|
|
I am bit new to exchange programming...I am implementing a protocol event sink with ISmtpInCommandSink interface and I am successful in getting the list of recipients through IMailMsgRecipientsBase Interface. Now I need to add my custom recipient to the message.I checked this using GetStringA( IMMPID_MP_RFC822_TO_ADDRESS....) but I getting the old recipient here. Also the message did not delivered to neither to old recipient nor to new recipient.
Any kind of help is just welcome...please...
IMailMsgRecipients *pIRcpt = {0};
IMailMsgRecipientsAdd *pIRcptAdd = {0};
hr = pIMsg->QueryInterface(__uuidof(IMailMsgRecipients),(LPVOID *)&pIRcpt);
//Get number of recipients
hr = pIRcpt->Count( &dwCount);
if( FAILED( hr ) )
{
goto EXIT;
}
//Get recipients name
hr = pIRcpt->Item(0,0,NAME_LEN,szRcptName );
if( FAILED( hr ) )
{
goto EXIT;
}
//Allocate new list for recipients
hr = pIRcpt->AllocNewList(& pIRcptAdd);
if( FAILED( hr ) )
{
goto EXIT;
}
//Add recipients
NSZ szPropBuffer[NAME_LEN] = "";
strcpy(szPropBuffer,"Administrator@nasa.local");
hr = pIRcptAdd->AddPrimary(1,(LPCSTR*) & pszPropBuffer,&dwPropID, &dwIndex,NULL, 0);
if( FAILED( hr ) )
{
goto EXIT;
}
hr = pIRcpt->WriteList(pIRcptAdd);
if( FAILED( hr ) ){
goto EXIT;
}
}
hr = pIMsg->GetStringA( IMMPID_MP_RFC822_TO_ADDRESS, sizeof(NSZ)*128, pszPropBuffer );
if( FAILED( hr ) )
{
goto EXIT;
}
|
|