Sender field missing in email object 
Author Message
 Sender field missing in email object

Is there a way to get the email of the sender from the MAPI structure with
VB script? I can see all other properties but not that one.

What's wrong, I would bet it is simply not there!

- bobby



Tue, 29 Apr 2003 16:59:36 GMT  
 Sender field missing in email object
The sender's email address is not exposed in the Outlook object model.
Instead you might want to take a look at
http://www.slipstick.com/dev/code/getsenderaddy.htm for some on ideas on how
to acquire.


Is there a way to get the email of the sender from the MAPI structure with
VB script? I can see all other properties but not that one.

What's wrong, I would bet it is simply not there!

- bobby



Tue, 29 Apr 2003 03:00:00 GMT  
 Sender field missing in email object
Bobby,

Did you ever get an answer to this?  I've been trying to do the same thing.
I need the sender's address (vs. Display name) in order to redirect
messages.  (The Outlook Help pages state that a Redirect capability was
added in OL2K, but I can't find anything about it!) I don't understand why
there are separate display and actual properties for other header fields,
but not the Sender.

dds


Quote:
> Is there a way to get the email of the sender from the MAPI structure with
> VB script? I can see all other properties but not that one.

> What's wrong, I would bet it is simply not there!

> - bobby



Fri, 16 May 2003 03:00:00 GMT  
 Sender field missing in email object
The actual address for the sender, as opposed to the display name, is
only available with certainty by using CDO. You can try creating a
dummy reply message, but if the ReplyTo address is different than the
sending address the two won't match.

Here's the CDO code for finding the sender's address for the currently
open item:

Sub FromAddress()
  Dim oNS As Outlook.NameSpace
  Dim oItm As Outlook.MailItem
  Dim obj As Object
  Dim oSession As MAPI.session
  Dim oMsg As MAPI.Message
  Dim oSndr As MAPI.AddressEntry
  Dim sAddress As String
  Dim sName As String
  Dim sEntry As String

  Set oNS = Application.GetNamespace("MAPI")
  'The ActiveInspector window is the currently active window
  'That is displaying individual Outlook items. Outlook folders
  'are displayed in Explorer windows.
  Set oItm = Application.ActiveInspector.CurrentItem
  'Sendername is the friendly name
  sName = oItm.SenderName
  'We need the EntryID of the item to locate it with CDO
  sEntry = oItm.EntryID

  'Establish a CDO (MAPI) Session object and logon to it
  Set oSession = CreateObject("MAPI.Session")
  oSession.Logon , , False, False

  'Locate the current message with the EntryID using CDO
  Set oMsg = oSession.GetMessage(sEntry)
  'Get the sender's name
  Set oSndr = oMsg.Sender
  'Get the actual email address
  sAddress = oSndr.Address
  'Display the information in a MsgBox
  MsgBox "Name: " & sName & vbCrLf & "Email Address: " _
    & sAddress, vbOKOnly

  oSession.Logoff

  Set oNS = Nothing
  Set oItm = Nothing
  Set obj = Nothing
  Set oSession = Nothing
  Set oMsg = Nothing
  Set oSndr = Nothing
End Sub

--
Ken Slovak
[MVP - Outlook]
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Co-author of "Programming Microsoft Outlook 2000", Chapters 8-13,
Appendices, Sams


Quote:
> Bobby,

> Did you ever get an answer to this?  I've been trying to do the same
thing.
> I need the sender's address (vs. Display name) in order to redirect
> messages.  (The Outlook Help pages state that a Redirect capability
was
> added in OL2K, but I can't find anything about it!) I don't
understand why
> there are separate display and actual properties for other header
fields,
> but not the Sender.

> dds



> > Is there a way to get the email of the sender from the MAPI
structure with
> > VB script? I can see all other properties but not that one.

> > What's wrong, I would bet it is simply not there!

> > - bobby



Sat, 17 May 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Custom Field - Sender EMAIL - Help

2. Finding Sender's Address in EMail:No MAPI Object Model

3. getting email senders Actual Email address

4. getting email senders actual email address

5. Make an object go to the to field in an email

6. VBA Outlook, sender's email, and Global address book

7. Programmatically adding an email address to Junk Senders list

8. Finding Value of senders email address

9. MailItem Sender email address

10. getting the senders email address

11. How to get Sender's email address using VBA

12. get sender's email adress

 

 
Powered by phpBB® Forum Software