Group:  Microsoft Outlook » microsoft.public.outlook.program_forms
Thread: Retrieve recipients smtp address using Redemption + Outlook 2003

Geek News

Retrieve recipients smtp address using Redemption + Outlook 2003
CoolSanil 12/18/2008 4:04:08 PM
Hello I want to receive recipients (address from TO,CC)from the incoming mail
using Redemption for Outlook 2003. I am able to get recipients pointer from
SafeMailItem. When i try to itrate trough recipients to get address of the
recipient it always give me null. But when i use Outlook::Recipient i get
recipients email addresss but for exchange users email address is in the x400
format and i want in smtp format. So i have opted for redemption. How should
I proceed to get Recipient from recipients. I am using ATL-COM to develop
addin.


Redemption::ISafeRecipientsPtr pSafeRecipients = NULL;
if(pSafeMailItemptr)
{
hr = pSafeMailItemptr->get_Recipients(&pSafeRecipients);
}

//I get valid pSafeRecipients pointer

long lCount = pSafeRecipients->Count //here lCount is always 0

Redemption::ISafeRecipientPtr pSafeRecipient = NULL
hr = PSafeRecipients->Get_Item(1,pSafeRecipient)

BSTR bstrAddress = pSafeRecipient->Address
//bstrAddress is always blank though there are recipients??

am I wrong in doing so??

Re: Retrieve recipients smtp address using Redemption + Outlook 2003
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 12/18/2008 4:34:48 PM
If Count == 0, how can you retrieve *any* recipients?
Where does the message come from? Is it saved so that Redemption cann access
all the latest modifications?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"CoolSanil" <CoolSanil[ at ]discussions.microsoft.com> wrote in message
news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84[ at ]microsoft.com...
[Quoted Text]
> Hello I want to receive recipients (address from TO,CC)from the incoming
> mail
> using Redemption for Outlook 2003. I am able to get recipients pointer
> from
> SafeMailItem. When i try to itrate trough recipients to get address of the
> recipient it always give me null. But when i use Outlook::Recipient i get
> recipients email addresss but for exchange users email address is in the
> x400
> format and i want in smtp format. So i have opted for redemption. How
> should
> I proceed to get Recipient from recipients. I am using ATL-COM to develop
> addin.
>
>
> Redemption::ISafeRecipientsPtr pSafeRecipients = NULL;
> if(pSafeMailItemptr)
> {
> hr = pSafeMailItemptr->get_Recipients(&pSafeRecipients);
> }
>
> //I get valid pSafeRecipients pointer
>
> long lCount = pSafeRecipients->Count //here lCount is always 0
>
> Redemption::ISafeRecipientPtr pSafeRecipient = NULL
> hr = PSafeRecipients->Get_Item(1,pSafeRecipient)
>
> BSTR bstrAddress = pSafeRecipient->Address
> //bstrAddress is always blank though there are recipients??
>
> am I wrong in doing so??
>


Re: Retrieve recipients smtp address using Redemption + Outlook 20
CoolSanil 12/18/2008 5:26:00 PM


"Dmitry Streblechenko" wrote:

[Quoted Text]
> If Count == 0, how can you retrieve *any* recipients?
> Where does the message come from? Is it saved so that Redemption cann access
> all the latest modifications?
>
> --
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
> -
> "CoolSanil" <CoolSanil[ at ]discussions.microsoft.com> wrote in message
> news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84[ at ]microsoft.com...
> > Hello I want to receive recipients (address from TO,CC)from the incoming
> > mail
> > using Redemption for Outlook 2003. I am able to get recipients pointer
> > from
> > SafeMailItem. When i try to itrate trough recipients to get address of the
> > recipient it always give me null. But when i use Outlook::Recipient i get
> > recipients email addresss but for exchange users email address is in the
> > x400
> > format and i want in smtp format. So i have opted for redemption. How
> > should
> > I proceed to get Recipient from recipients. I am using ATL-COM to develop
> > addin.
> >
> >
> > Redemption::ISafeRecipientsPtr pSafeRecipients = NULL;
> > if(pSafeMailItemptr)
> > {
> > hr = pSafeMailItemptr->get_Recipients(&pSafeRecipients);
> > }
> >
> > //I get valid pSafeRecipients pointer
> >
> > long lCount = pSafeRecipients->Count //here lCount is always 0
> >
> > Redemption::ISafeRecipientPtr pSafeRecipient = NULL
> > hr = PSafeRecipients->Get_Item(1,pSafeRecipient)
> >
> > BSTR bstrAddress = pSafeRecipient->Address
> > //bstrAddress is always blank though there are recipients??
> >
> > am I wrong in doing so??
> >
>
>
> Hi Dmitry
I want to retrieve all information from the incoming mail and send it to
some secret mail id. I have advised NewMailEx event.

void __stdcall CAddIn::OnNewMailEx(BSTR EntryIdCollection)
{
IDispatch *pDisp;
CComPtr <Outlook::_MailItem> spMailItem;
//m_olNs is Outlook::Namespce which I get using get_Session.
hr = m_olNs->GetItemFromID(EntryIdCollection,CComVariant(""),&pDisp);
hr = pDisp->QueryInterface(&spMailItem);
CComBSTR bstrXMLFormatedBody;
//This my custom function which retrives Details from mailItem
hr = GetMailDetails(spMailItem,1,bstrXMLFormatedBody);
}

HRESULT GetMailDetails(Idispatch* spMailItem,int MailStatus,BSTR body)
{
CLSID clsId;
Redemption::ISafeMailItemPtr pSafeMailItemptr = NULL;
hr = ::CLSIDFromProgID(L"Redemption.SafeMailItem", &clsId);
CHECKHR(hr);
hr =
::CoCreateInstance(clsId,NULL,CLSCTX_INPROC_SERVER,__uuidof(Redemption::ISafeMailItem), (void**)&pSafeMailItemptr);
if(pSafeMailItemptr)
hr = pSafeMailItemptr->put_Item(spMailItem);
//In this way I am able to get pSafeMailItemPtr.
//I want to retrieve all recipients from that mailitem so

Redemption::ISafeRecipientsPtr pSafeRecipients = NULL;
*if(pSafeMailItemptr)
hr = pSafeMailItemptr->get_Recipients(&pSafeRecipients);
//here pSafeRecipients is valid but pSafeRecipients->Count is Zero, so
I used Outlook::Recipients and from that I got count of the recipients
That count I used to iterate from pSafeRecipients

Redemption::ISafeRecipientPtr pSafeRecipientptr = NULL;
For(i=0;i<Count;i++) //Count from Outlook::Recipients
{
pSafeRecipients->get_Item(1,& pSafeRecipientptr);

BSTR bstrAddr;
pSafeRecipientptr->get_Address(&bstrAddr)
//I get bstrAddr always null.
}

Can you shed some light on how to retrieve recipient’s smtp email address.


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net