You are here: Office-Outlook.com  / Outlook Forum

Retrieve recipients smtp address using Redemption + Outlook 2003

Home » Outlook addins and plugins development » Outlook forms
Retrieve recipients smtp address using Redemption + Outlook 2003 [message #453013] Thu, 18 December 2008 08:04 Go to next message
CoolSanil
Messages: 31
Registered: December 2008
Member
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 [message #453042] Thu, 18 December 2008 09:26 Go to previous message
CoolSanil
Messages: 31
Registered: December 2008
Member
"Dmitry Streblechenko" wrote:

> 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@discussions.microsoft.com> wrote in message
> news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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.
Re: Retrieve recipients smtp address using Redemption + Outlook 20 [message #458271] Thu, 18 December 2008 09:26 Go to previous message
CoolSanil
Messages: 31
Registered: December 2008
Member
"Dmitry Streblechenko" wrote:

> 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@discussions.microsoft.com> wrote in message
> news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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.
Re: Retrieve recipients smtp address using Redemption + Outlook 2003 [message #458856] Thu, 18 December 2008 08:34 Go to previous message
Dmitry Streblechenko
Messages: 2617
Registered: May 2006
Senior Member
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@discussions.microsoft.com> wrote in message
news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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??
>
Re: Retrieve recipients smtp address using Redemption + Outlook 20 [message #458858] Thu, 18 December 2008 09:26 Go to previous message
CoolSanil
Messages: 31
Registered: December 2008
Member
"Dmitry Streblechenko" wrote:

> 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@discussions.microsoft.com> wrote in message
> news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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.
Re: Retrieve recipients smtp address using Redemption + Outlook 2003 [message #460341] Thu, 18 December 2008 08:34 Go to previous message
Dmitry Streblechenko
Messages: 2617
Registered: May 2006
Senior Member
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@discussions.microsoft.com> wrote in message
news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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??
>
Re: Retrieve recipients smtp address using Redemption + Outlook 20 [message #460343] Thu, 18 December 2008 09:26 Go to previous message
CoolSanil
Messages: 31
Registered: December 2008
Member
"Dmitry Streblechenko" wrote:

> 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@discussions.microsoft.com> wrote in message
> news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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.
Re: Retrieve recipients smtp address using Redemption + Outlook 2003 [message #461360] Thu, 18 December 2008 08:34 Go to previous message
Dmitry Streblechenko
Messages: 2617
Registered: May 2006
Senior Member
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@discussions.microsoft.com> wrote in message
news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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??
>
Re: Retrieve recipients smtp address using Redemption + Outlook 20 [message #461362] Thu, 18 December 2008 09:26 Go to previous message
CoolSanil
Messages: 31
Registered: December 2008
Member
"Dmitry Streblechenko" wrote:

> 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@discussions.microsoft.com> wrote in message
> news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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.
Re: Retrieve recipients smtp address using Redemption + Outlook 2003 [message #462809] Thu, 18 December 2008 08:34 Go to previous message
Dmitry Streblechenko
Messages: 2617
Registered: May 2006
Senior Member
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@discussions.microsoft.com> wrote in message
news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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??
>
Re: Retrieve recipients smtp address using Redemption + Outlook 20 [message #462811] Thu, 18 December 2008 09:26 Go to previous message
CoolSanil
Messages: 31
Registered: December 2008
Member
"Dmitry Streblechenko" wrote:

> 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@discussions.microsoft.com> wrote in message
> news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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.
Re: Retrieve recipients smtp address using Redemption + Outlook 2003 [message #463386] Thu, 18 December 2008 08:34 Go to previous message
Dmitry Streblechenko
Messages: 2617
Registered: May 2006
Senior Member
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@discussions.microsoft.com> wrote in message
news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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??
>
Re: Retrieve recipients smtp address using Redemption + Outlook 20 [message #463388] Thu, 18 December 2008 09:26 Go to previous message
CoolSanil
Messages: 31
Registered: December 2008
Member
"Dmitry Streblechenko" wrote:

> 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@discussions.microsoft.com> wrote in message
> news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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.
Re: Retrieve recipients smtp address using Redemption + Outlook 2003 [message #464381] Thu, 18 December 2008 08:34 Go to previous message
Dmitry Streblechenko
Messages: 2617
Registered: May 2006
Senior Member
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@discussions.microsoft.com> wrote in message
news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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??
>
Re: Retrieve recipients smtp address using Redemption + Outlook 20 [message #464383] Thu, 18 December 2008 09:26 Go to previous message
CoolSanil
Messages: 31
Registered: December 2008
Member
"Dmitry Streblechenko" wrote:

> 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@discussions.microsoft.com> wrote in message
> news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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.
Re: Retrieve recipients smtp address using Redemption + Outlook 2003 [message #464940] Thu, 18 December 2008 08:34 Go to previous message
Dmitry Streblechenko
Messages: 2617
Registered: May 2006
Senior Member
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@discussions.microsoft.com> wrote in message
news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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??
>
Re: Retrieve recipients smtp address using Redemption + Outlook 20 [message #464942] Thu, 18 December 2008 09:26 Go to previous message
CoolSanil
Messages: 31
Registered: December 2008
Member
"Dmitry Streblechenko" wrote:

> 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@discussions.microsoft.com> wrote in message
> news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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.
Re: Retrieve recipients smtp address using Redemption + Outlook 2003 [message #467001] Thu, 18 December 2008 08:34 Go to previous message
Dmitry Streblechenko
Messages: 2617
Registered: May 2006
Senior Member
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@discussions.microsoft.com> wrote in message
news:0D52B9A2-7A0F-4179-AE50-FB44EA48DD84@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??
>
Previous Topic:IE popup in Outlook 12.0
Next Topic:Unexpected email message
Goto Forum: