Getting the email address

G

Guest

hello!

I'm trying to save the email address of an email that was sent to me, in a
variable, so I can use it in the future (to send it to a DB in access). I am
using a custom userform in outlook. I know there is "subject", "body", "CC",
"BCC", but what is for the email address?

thanks, Yonina.
 
P

Papastefanos Serafeim

Due to security reasons, you cannot do this with outlook object model.
You can use CDO or RDO for that. BUT, you can also try the following
solution:

Let's say that mail is the MailItem from which you want to find the sender
address.
Write this:

Dim repmail As Outlook.MailItem
Set repmail = mail.Reply
Dim reprecp As Outlook.Recipient
Set reprecp = repmail.Recipients(1)
Msgbox(reprecp.Address)

As you see, if you reply an email you got, you can find it's sender address
from
the reply's recipients property.
Warning. This code isn't working with emails in your Outbox or Deleted
items
folder. Do some tests.


Papastefanos Serafeim
 
G

Guest

it worked, but I found a better property: ineml.SenderEmailAddress
it gives me the email address, hooray!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
P

Papastefanos Serafeim

I do agree with that, but I think that the SenderEmailAddress property
doesn't exist in Outlook 2000.

CDO is a free microsoft library which can be installed along with
Outlook and gives you access to more email properties than the
Outlook Object model.

RDO is a commercial third party library which is a CDO replacement
and has more capabilities (like ignoring security restrictions of Outlook
2002).

Papastefanos Serafeim
 
G

Guest

Maybe. I am using 2003.

Papastefanos Serafeim said:
I do agree with that, but I think that the SenderEmailAddress property
doesn't exist in Outlook 2000.

CDO is a free microsoft library which can be installed along with
Outlook and gives you access to more email properties than the
Outlook Object model.

RDO is a commercial third party library which is a CDO replacement
and has more capabilities (like ignoring security restrictions of Outlook
2002).

Papastefanos Serafeim
 
K

Ken Slovak - [MVP - Outlook]

Redemption, which contains the RDO objects is at www.dimastr.com/redemption.

CDO 1.21 is not secure and is subject to even more stringent security
controls for access to restricted properties than the Outlook object model
is subject to. Only server side CDO 1.21, installed on the Exchange server,
isn't subject to the security model.
 
G

Guest

Hi,
I saw you post and thought you might be able to help.
I have email addresses saved in excel file which I send files too. However,
I have emails from people in a folder Inbox-BFP, that I also need to send the
file to. Is there anyway to "export" or create an excel list of the email
addresses from the emails that people have sent me in that folder, and not
duplicating addresses. Any help would be appreciated? Maybe using the
ineml.SenderEmailAddress somehow?
I use Outlook and Excel 2003.
Much thx in advance!

David
 

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