Alternately, how would you get the message headers? I
don't see a property for that either.
Thanks.
Set Reply = CurrentMail.Reply
Reply.Recipients will include sender email address.
There are other ways if you use advanced MAPI. You can read my question
dated 2003-01-28 in this newsgroup and read answers there.
Regards
/Hans Börjesson
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.slipstick.com/books/jumpstart.htm
"MJ" <jaco...@yahoo.com> wrote in message news:004501c2d7d7$a7bdf5e0$2f01...@phx.gbl...
I'm trying to do this on a box unattached to an exchange
server (getting internet mail only) and nothing extra
(like CDO installed).
Is there a way to get the Message Headers? Maybe using
some MAPI API?
Any other ideas?
Thanks.
>.
>
You did see, didn't you, that you can easily get the reply address with Outlook objects only? That's more relevant than the actual From address in many cases.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.slipstick.com/books/jumpstart.htm
"MJ" <jaco...@yahoo.com> wrote in message news:01a501c2d85b$1ef85550$a401...@phx.gbl...
> I would think there's got to be another way. From what I
> understand you have to specifically install CDO, yet
> inside outlook, there appears to be no problem returning
> the senders email address or internet headers. Yet
> another undocumented API?
>
> I'm trying to do this on a box unattached to an exchange
> server (getting internet mail only) and nothing extra
> (like CDO installed).
>
> Is there a way to get the Message Headers? Maybe using
> some MAPI API?
>
> Any other ideas?
>
> Thanks.
>
> >-----Original Message-----
> >There is no Outlook property that returns the sender's
> email address. You can either use CDO (or Redemption to
> avoid security prompts --
> http://www.dimastr.com/redemption/) to get the From
> address or use Outlook to get the Reply To address, as
> Hans suggested. Sample code at
> http://www.slipstick.com/dev/code/getsenderaddy.htm.
> >
I guess I'll have to look into Extended MAPI a bit as well
as the reply address.
I'm also having an issue registering the NewMail event.
I've even tried rebuilding the Interop.Outlook.dll as
suggested by a MS KB article. Any insight on that?
Thanks,
Mark
>.
>
I'd suggest you start a separate thread with details on your NewMail issue in the microsoft.public.outlook.program_addins newsgroup or a C# group. Outlook with .Net is full of pitfalls at the present time. Unless you have a burning need to use C#, a VB or Delphi or C++ approach might be better.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.slipstick.com/books/jumpstart.htm
"MJ" <jaco...@yahoo.com> wrote in message news:071e01c2d8e9$2fbbeda0$a201...@phx.gbl...
> I still need to play around w/ the reply to address some
> more. The biggest problems I'm coming across are that I'm
> trying to do this in C# and almost every example I see is
> for VB.
>
> I guess I'll have to look into Extended MAPI a bit as well
> as the reply address.
>
> I'm also having an issue registering the NewMail event.
> I've even tried rebuilding the Interop.Outlook.dll as
> suggested by a MS KB article. Any insight on that?
>
> Thanks,
> Mark
>
> >-----Original Message-----
> >Same thing: To access the message headers, you must use
> CDO or Redemption or, in C++ or Delphi, Extended MAPI.
> >
> >You did see, didn't you, that you can easily get the
> reply address with Outlook objects only? That's more
> relevant than the actual From address in many cases.
> >
> >
I have a code to get header if you want in CDO
I acquire the mail item and I can not get the sender's
email address.
In the case of redemption code, SafeMailItem, the sender
field returns nothing.
The creation of a reply to a mailitem being sent also did
not work.
Any idea ?
Thank you.
>.
>
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.slipstick.com/books/jumpstart.htm
"Rajesh KAnungo" <kanu...@yahoo.com> wrote in message news:07d701c2da16$f3c45060$2f01...@phx.gbl...
Class foo ...
Private WithEvents m_MailItem As Outlook.MailItem
Private Sub m_MailItem_Send(Cancel As Boolean)
On Error Resume Next
Dim senderAddr as string
senderAddr = GetSenderAddress()
msgbox "I got an address !!! " & senderAddr
End Sub
Function GetSenderAddress() As String
Dim strType As String
Dim objSenderAE As Redemption.AddressEntry
Dim objSMail As Redemption.SafeMailItem
Const PR_SENDER_ADDRTYPE = &HC1E001E
Const PR_EMAIL = &H39FE001E
Set objSMail = CreateObject("Redemption.SafeMailItem")
objSMail.item = m_MailItem
' XXX strType : This comes back empty
strType = objSMail.Fields(PR_SENDER_ADDRTYPE)
' XXX objSenderAE comes back nothing
Set objSenderAE = objSMail.sender
If Not objSenderAE Is Nothing Then
If strType = "SMTP" Then
GetSenderAddress = objSenderAE.Address
ElseIf strType = "EX" Then
GetSenderAddress = objSenderAE.Fields(PR_EMAIL)
End If
End If
Set objSenderAE = Nothing
Set objSMail = Nothing
'Dim utils As Redemption.MAPIUtils
'Dim SenderEMail As String
'Set utils = CreateObject("Redemption.MAPIUtils")
'Const PrSenderEmailAddress = &HC1F001E
' XXX Even the following returns empty.
'SenderEMail = utils.HrGetOneProp(m_MailItem.MAPIOBJECT,
' PrSenderEmailAddress)
'MsgBox SenderEMail
End Function
>.
>
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.slipstick.com/books/jumpstart.htm
"Rajesh Kanungo" <kanu...@yahoo.com> wrote in message news:030c01c2da28$9fabd220$a501...@phx.gbl...
> Good idea. My apologies. I have enclosed the simplest
> form. The code is run as an addin.
> Description:
> m_MailItemSend calls GetSenderAddress.
> GetSenderAddress calls outlook redemption. Very close to
> the posting on the slipstick.
> >
I Have: a received email to which I may reply.
I need: received email's sender and the recipient email
addresses.
I was trying to get the information from the newly created
reply but that is not necessary on second thoughts.
I will try to see if MailItem.ReceivedByName can be used
to get the email addresses.
-- Rajesh
>.
>
Use one of the methods given earlier. They will work quite differently on an already received message than on a new message that you are trying to send.
> and the recipient email addresses.
Enumerate the the MailItem.Recipients collection.
> I will try to see if MailItem.ReceivedByName can be used
> to get the email addresses.
If ReceivedByName returns anything on a message that *you* received, it will be *your* name.
-- Rajesh
>.
>
An alternative technique is to use CDO or Redemption to obtain the SMTP headers for the message. See http://www.slipstick.com/dev/olforms/headers.htm for an Outlook form that demonstrates the technique.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.slipstick.com/books/jumpstart.htm
"Rajesh Kanungo" <kanu...@yahoo.com> wrote in message news:03dd01c2dac9$77b382d0$a001...@phx.gbl...