Looking for email address under ItemSend event

Status
Not open for further replies.
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)

-

"BVM" <DennisH@TBH.com.au> wrote in message news:OafLpRE3KHA.4336@TK2MSFTNGP04.phx.gbl...

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.

"Dmitry Streblechenko" <dmitry@dimastr.com> wrote in message

news:eBX3WTG3KHA.4016@TK2MSFTNGP05.phx.gbl...

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)

-
 
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

"Dmitry Streblechenko" <dmitry@dimastr.com> wrote in message news:eBX3WTG3KHA.4016@TK2MSFTNGP05.phx.gbl...

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)

-

"BVM" <DennisH@TBH.com.au> wrote in message news:OafLpRE3KHA.4336@TK2MSFTNGP04.phx.gbl...

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)

-

"BVM" <DennisH@TBH.com.au> wrote in message news:e0iqAZQ3KHA.3844@TK2MSFTNGP05.phx.gbl...

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

"Dmitry Streblechenko" <dmitry@dimastr.com> wrote in message news:eBX3WTG3KHA.4016@TK2MSFTNGP05.phx.gbl...

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)

-

"BVM" <DennisH@TBH.com.au> wrote in message news:OafLpRE3KHA.4336@TK2MSFTNGP04.phx.gbl...

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

"Dmitry Streblechenko" <dmitry@dimastr.com> wrote in message news:O$qh8M$3KHA.4336@TK2MSFTNGP04.phx.gbl...

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)

-

"BVM" <DennisH@TBH.com.au> wrote in message news:e0iqAZQ3KHA.3844@TK2MSFTNGP05.phx.gbl...

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

"Dmitry Streblechenko" <dmitry@dimastr.com> wrote in message news:eBX3WTG3KHA.4016@TK2MSFTNGP05.phx.gbl...

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)

-

"BVM" <DennisH@TBH.com.au> wrote in message news:OafLpRE3KHA.4336@TK2MSFTNGP04.phx.gbl...

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)

-

"BVM" <DennisH@TBH.com.au> wrote in message news:u92ZzeC4KHA.5880@TK2MSFTNGP04.phx.gbl...

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

"Dmitry Streblechenko" <dmitry@dimastr.com> wrote in message news:O$qh8M$3KHA.4336@TK2MSFTNGP04.phx.gbl...

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)

-

"BVM" <DennisH@TBH.com.au> wrote in message news:e0iqAZQ3KHA.3844@TK2MSFTNGP05.phx.gbl...

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

"Dmitry Streblechenko" <dmitry@dimastr.com> wrote in message news:eBX3WTG3KHA.4016@TK2MSFTNGP05.phx.gbl...

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)

-

"BVM" <DennisH@TBH.com.au> wrote in message news:OafLpRE3KHA.4336@TK2MSFTNGP04.phx.gbl...

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
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
B Looking to get the Recipient email address (or even the "friendly name") from an email I am replying to using VBA Outlook VBA and Custom Forms 4
Aussie Looking for Outlook macro to Copy Recipient Names into Email Body Outlook VBA and Custom Forms 3
J Looking for a solution (maybe an add-in) to easily track email conversations Using Outlook 3
sophievldn Looking for a macro that moves completed items from subfolders to other subfolder Outlook VBA and Custom Forms 7
C Looking for feedback on new Outlook Add-in Using Outlook 0
B Looking to filter (or just find/search) for only messages that the sender has sent more than 1 messa Using Outlook 2
G Looking for help with our Organization Forms Library Outlook VBA and Custom Forms 1
peacepanda How to save attachment looking at the attachment name Outlook VBA and Custom Forms 1
D Looking to move away from exchange to outlook.com Using Outlook 4
B Looking for Outlook 2013 update for Send Drafts Macro Using Outlook 4
M Looking for options and best practices for an Edge Server (Exchange or not) Exchange Server Administration 0
M Looking for trainer in Business Contact Manager BCM (Business Contact Manager) 0
O looking to bring in all my folders from Outlook Express (XP) to Outlook 2013 Using Outlook 3
B Looking for an add-in or a way to send automatic replies based off a list Using Outlook 2
R Outlook Template: Looking to distribute a VBA Outlook template to other people Using Outlook 1
I Looking for a productivity add-in similar to "Nostalgy" for Thunderbird Using Outlook 5
Q Looking for Outlook 2010 Close Event Id Exchange Server Administration 1
C Looking for way to tie a Business Contact to more than one Account BCM (Business Contact Manager) 5
J OL2003 Macro disables itself - looking for way to automate 'enable' Using Outlook 2
R Looking for my BCM backup files BCM (Business Contact Manager) 1
S Looking for client-side method (Outlook 2007/Exchange 2007) for users to delete Outlook VBA and Custom Forms 2
S Looking for a Utility for Editting An Exported Rules (.rwz) File Using Outlook 6
P Outlook looking for Copy of Outlook.pst Outlook VBA and Custom Forms 1
U looking for feedback on installation process and on eMarking Assis Outlook VBA and Custom Forms 1
F Add a category before "Send an Email When You Add an Appointment to Your Calendar" Outlook VBA and Custom Forms 0
T Problem when requesting to view an email in a browser Using Outlook 0
J Outlook 365 Forward Email Subject to my inbox when new email arrive in shared inbox Using Outlook 0
HarvMan Archive Email Manually Using Outlook 0
L Fetch, edit and forward an email with VBA outlook Outlook VBA and Custom Forms 2
S New Email "From" box stopped working Using Outlook 0
Rupert Dragwater Duplicate email in Folder Using Outlook 7
M "Attachment Detacher for Outlook" add in, does it update the server copy of the email? Using Outlook 1
W Outlook 365 I am getting the "Either there is no default mail client" error when I try to send an email on excel Office 365 Using Outlook 1
MattC Changing the font of an email with VBA Outlook VBA and Custom Forms 0
L Specific Incoming Email Address Immediately Deleted Using Outlook 2
Witzker Outlook 2019 Macro to send an Email Template from User Defined Contact Form Outlook VBA and Custom Forms 0
Witzker Outlook 2019 Edit contact from email does not open the user defined contactform Using Outlook 3
V Macro to mark email with a Category Outlook VBA and Custom Forms 4
R Roadrunner Email Settings | Contact Roadrunner Customer Support Outlook VBA and Custom Forms 1
D Gmail mail is being delivered to a different email inbox in Outlook App 2021 Using Outlook 2
Albert McCann Outlook 2021 Outlook Display of HTML Email from two senders is glitchy Using Outlook 0
A How Do I Setup My Optonline.Net Email Account? Outlook VBA and Custom Forms 1
H Preventing the 'email address fetch from Exchange' crashing email reading code Exchange Server Administration 0
D multiple email accounts - why do I have to choose the "from" account address?? Using Outlook 2
Wotme create email only data file Using Outlook 1
F Outlook 2016 Email with attachments not being received Using Outlook 3
J Outlook 2019 Regex email addresses from body Outlook VBA and Custom Forms 6
D Prompt to prefix subject line whenever sending an email Outlook VBA and Custom Forms 3
J Quick steps delete original email and move reply/sent email to folder Using Outlook 2
C Wishlist Extract or scan new email addresses from out of office replies. Leads from OOO replies Using Outlook 1

Similar threads

Top