Looking for email address under ItemSend event

B

BVM

Hi,

I need to retrieve recipients' email addresses and sender's email address when an ItemSend event is raised. I just cannot get them, even I use Redemption MapiUtils. Like string lsAddresseeEmail = (string)utils.HrGetOneProp(mail.Recipients[1].AddressEntry.MAPIOBJECT, PrSMTPAddress);

Is it because the email has not really been sent, so I cannot get them? Is there any way to get the email addresses?

I am using Windows XP, Outlook 2003 and VS2005

Thanks,

Danny
 
D

Dmitry Streblechenko

Can you access othe rproperties (such as PR_DISPLAY_NAME)?
Note that PR_SMTP_ADDRESS is not guarentee to be present.
Secondly, keep in mind that MAPIUtils object is being deprecated, use RDOSession instead.

Off the top of my head:

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
....
set AE = Session.GetAddressEntryFromID(mail.Recipients[1].EntryID)
MsgBox AE.SmtpAddress


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Hi,

I need to retrieve recipients' email addresses and sender's email address when an ItemSend event is raised. I just cannot get them, even I use Redemption MapiUtils. Like string lsAddresseeEmail = (string)utils.HrGetOneProp(mail.Recipients[1].AddressEntry.MAPIOBJECT, PrSMTPAddress);

Is it because the email has not really been sent, so I cannot get them? Is there any way to get the email addresses?

I am using Windows XP, Outlook 2003 and VS2005

Thanks,

Danny
 
K

Ken Slovak - [MVP - Outlook]

Another thing to make sure of is that the item is saved before you try to
read many of the properties, otherwise they won't be populated yet.




Can you access othe rproperties (such as PR_DISPLAY_NAME)?
Note that PR_SMTP_ADDRESS is not guarentee to be present.
Secondly, keep in mind that MAPIUtils object is being deprecated, use
RDOSession instead.

Off the top of my head:

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
...
set AE = Session.GetAddressEntryFromID(mail.Recipients[1].EntryID)
MsgBox AE.SmtpAddress


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
B

BVM

Thanks, Dmitry.

I can get Display Name, RDOSession works fine for retrieving recipients email address. But how to get sender's email address?

Thanks,

Danny
Can you access othe rproperties (such as PR_DISPLAY_NAME)?
Note that PR_SMTP_ADDRESS is not guarentee to be present.
Secondly, keep in mind that MAPIUtils object is being deprecated, use RDOSession instead.

Off the top of my head:

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
...
set AE = Session.GetAddressEntryFromID(mail.Recipients[1].EntryID)
MsgBox AE.SmtpAddress


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Hi,

I need to retrieve recipients' email addresses and sender's email address when an ItemSend event is raised. I just cannot get them, even I use Redemption MapiUtils. Like string lsAddresseeEmail = (string)utils.HrGetOneProp(mail.Recipients[1].AddressEntry.MAPIOBJECT, PrSMTPAddress);

Is it because the email has not really been sent, so I cannot get them? Is there any way to get the email addresses?

I am using Windows XP, Outlook 2003 and VS2005

Thanks,

Danny
 
D

Dmitry Streblechenko

Byt he time ItemSEnt evenbt is fired, the sender properties (RDOMail.Sender) are not yet set. That will happen later when teh mesage is moved to the Sent Items folder. You can use Items.ItemAdd even on the Sent Items folder to take advantage of that.
Otherwise you ca look at the RDOMail.Account property - for the RDOPOP3Account obejct you will be able to retrieve teh address related properties. If the mesage is beign sent through teh default account (RDOMial.Account = null), use the RDOSession.CurrentUser object.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Thanks, Dmitry.

I can get Display Name, RDOSession works fine for retrieving recipients email address. But how to get sender's email address?

Thanks,

Danny
Can you access othe rproperties (such as PR_DISPLAY_NAME)?
Note that PR_SMTP_ADDRESS is not guarentee to be present.
Secondly, keep in mind that MAPIUtils object is being deprecated, use RDOSession instead.

Off the top of my head:

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
...
set AE = Session.GetAddressEntryFromID(mail.Recipients[1].EntryID)
MsgBox AE.SmtpAddress


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Hi,

I need to retrieve recipients' email addresses and sender's email address when an ItemSend event is raised. I just cannot get them, even I use Redemption MapiUtils. Like string lsAddresseeEmail = (string)utils.HrGetOneProp(mail.Recipients[1].AddressEntry.MAPIOBJECT, PrSMTPAddress);

Is it because the email has not really been sent, so I cannot get them? Is there any way to get the email addresses?

I am using Windows XP, Outlook 2003 and VS2005

Thanks,

Danny
 
B

BVM

Thanks, Dmitry.

Do you mean I can watch the Sent Items folder? I can get notified everytime an email moved to that folder? I want this feature too. Where can I start with, ActiveExplorer()?

Thanks,

Danny
Byt he time ItemSEnt evenbt is fired, the sender properties (RDOMail.Sender) are not yet set. That will happen later when teh mesage is moved to the Sent Items folder. You can use Items.ItemAdd even on the Sent Items folder to take advantage of that.
Otherwise you ca look at the RDOMail.Account property - for the RDOPOP3Account obejct you will be able to retrieve teh address related properties. If the mesage is beign sent through teh default account (RDOMial.Account = null), use the RDOSession.CurrentUser object.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Thanks, Dmitry.

I can get Display Name, RDOSession works fine for retrieving recipients email address. But how to get sender's email address?

Thanks,

Danny
Can you access othe rproperties (such as PR_DISPLAY_NAME)?
Note that PR_SMTP_ADDRESS is not guarentee to be present.
Secondly, keep in mind that MAPIUtils object is being deprecated, use RDOSession instead.

Off the top of my head:

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
...
set AE = Session.GetAddressEntryFromID(mail.Recipients[1].EntryID)
MsgBox AE.SmtpAddress


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Hi,

I need to retrieve recipients' email addresses and sender's email address when an ItemSend event is raised. I just cannot get them, even I use Redemption MapiUtils. Like string lsAddresseeEmail = (string)utils.HrGetOneProp(mail.Recipients[1].AddressEntry.MAPIOBJECT, PrSMTPAddress);

Is it because the email has not really been sent, so I cannot get them? Is there any way to get the email addresses?

I am using Windows XP, Outlook 2003 and VS2005

Thanks,

Danny
 
D

Dmitry Streblechenko

No, call Namespace.GetDefaultFolder(olFolderSentMail) (get back MAPIFolder), read MAPIFolder.Items property and store it in a global (class) variable.
You will need Items.ItemAdd event

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Thanks, Dmitry.

Do you mean I can watch the Sent Items folder? I can get notified everytime an email moved to that folder? I want this feature too. Where can I start with, ActiveExplorer()?

Thanks,

Danny
Byt he time ItemSEnt evenbt is fired, the sender properties (RDOMail.Sender) are not yet set. That will happen later when teh mesage is moved to the Sent Items folder. You can use Items.ItemAdd even on the Sent Items folder to take advantage of that.
Otherwise you ca look at the RDOMail.Account property - for the RDOPOP3Account obejct you will be able to retrieve teh address related properties. If the mesage is beign sent through teh default account (RDOMial.Account = null), use the RDOSession.CurrentUser object.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Thanks, Dmitry.

I can get Display Name, RDOSession works fine for retrieving recipients email address. But how to get sender's email address?

Thanks,

Danny
Can you access othe rproperties (such as PR_DISPLAY_NAME)?
Note that PR_SMTP_ADDRESS is not guarentee to be present.
Secondly, keep in mind that MAPIUtils object is being deprecated, use RDOSession instead.

Off the top of my head:

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
...
set AE = Session.GetAddressEntryFromID(mail.Recipients[1].EntryID)
MsgBox AE.SmtpAddress


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Hi,

I need to retrieve recipients' email addresses and sender's email address when an ItemSend event is raised. I just cannot get them, even I use Redemption MapiUtils. Like string lsAddresseeEmail = (string)utils.HrGetOneProp(mail.Recipients[1].AddressEntry.MAPIOBJECT, PrSMTPAddress);

Is it because the email has not really been sent, so I cannot get them? Is there any way to get the email addresses?

I am using Windows XP, Outlook 2003 and VS2005

Thanks,

Danny
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top