A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Reading SMTP address from Exchange Sender mail address



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 1st 09, 02:17 PM posted to microsoft.public.outlook.program_vba
VebKol
external usenet poster
 
Posts: 7
Default Reading SMTP address from Exchange Sender mail address

Hi

I'm facing problems getting SMTP address from Exchange sender mail address.
- Using Redemption :-)

I have used this line to loop recipients
PrSMTPAddress = &H39FE001E
SMTPAddress =
utils.HrGetOneProp(MailItem.Recipients(t).AddressE ntry.MAPIOBJECT,
PrSMTPAddress)

And everything is working fine.

But when I try to do the following :

PrSMTPAddress = &HC1F001E
SMTPAddress = utils.HrGetOneProp(MailItem.MAPIOBJECT, PrSMTPAddress)

for the Exchange sender, I only get address like this :
/O=server/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=name

for external senders the mail address is ok :-)


Do any one have a clue ?

--
Regards
OD
Ads
  #2  
Old February 1st 09, 06:35 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Reading SMTP address from Exchange Sender mail address

PR_SENDER_EMAIL_ADDRESS (&HC1F001E) is isn't guaranteed to be an SMTP
address. If the sender is an internal sender you will get the Exchange DN,
as you've seen.

You can check to see if the address type is SMTP by checking
PR_SENDER_ADDRTYPE (0x0C1E001E), a PT_STRING8 value. In that case you need
to use PR_SMTP_ADDRESS (&H39FE001E).

PR_SMTP_ADDRESS is not available in cached mode. You would use
PR_EMS_AB_PROXY_ADDRESSES (&H800F101E) in cached mode, which is a
PT_MV_STRING8 (string array) property.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"VebKol" wrote in message
...
Hi

I'm facing problems getting SMTP address from Exchange sender mail
address.
- Using Redemption :-)

I have used this line to loop recipients
PrSMTPAddress = &H39FE001E
SMTPAddress =
utils.HrGetOneProp(MailItem.Recipients(t).AddressE ntry.MAPIOBJECT,
PrSMTPAddress)

And everything is working fine.

But when I try to do the following :

PrSMTPAddress = &HC1F001E
SMTPAddress = utils.HrGetOneProp(MailItem.MAPIOBJECT, PrSMTPAddress)

for the Exchange sender, I only get address like this :
/O=server/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=name

for external senders the mail address is ok :-)


Do any one have a clue ?

--
Regards
OD


  #3  
Old February 1st 09, 07:20 PM posted to microsoft.public.outlook.program_vba
VebKol
external usenet poster
 
Posts: 7
Default Reading SMTP address from Exchange Sender mail address

Again Mr. Slovak : You are the KING !!!!!

Thanks : "all" my problems are now sloved !

:-) :-) :-)

--
Regards
OD


"Ken Slovak - [MVP - Outlook]" wrote:

PR_SENDER_EMAIL_ADDRESS (&HC1F001E) is isn't guaranteed to be an SMTP
address. If the sender is an internal sender you will get the Exchange DN,
as you've seen.

You can check to see if the address type is SMTP by checking
PR_SENDER_ADDRTYPE (0x0C1E001E), a PT_STRING8 value. In that case you need
to use PR_SMTP_ADDRESS (&H39FE001E).

PR_SMTP_ADDRESS is not available in cached mode. You would use
PR_EMS_AB_PROXY_ADDRESSES (&H800F101E) in cached mode, which is a
PT_MV_STRING8 (string array) property.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"VebKol" wrote in message
...
Hi

I'm facing problems getting SMTP address from Exchange sender mail
address.
- Using Redemption :-)

I have used this line to loop recipients
PrSMTPAddress = &H39FE001E
SMTPAddress =
utils.HrGetOneProp(MailItem.Recipients(t).AddressE ntry.MAPIOBJECT,
PrSMTPAddress)

And everything is working fine.

But when I try to do the following :

PrSMTPAddress = &HC1F001E
SMTPAddress = utils.HrGetOneProp(MailItem.MAPIOBJECT, PrSMTPAddress)

for the Exchange sender, I only get address like this :
/O=server/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=name

for external senders the mail address is ok :-)


Do any one have a clue ?

--
Regards
OD



  #4  
Old February 2nd 09, 04:46 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Reading SMTP address from Exchange Sender mail address

If you are already using Redemption, you do not need to jump through all
these hoops, Redemption will do that for you: simply read the
Sender.SmtpAddress property.

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

I'm facing problems getting SMTP address from Exchange sender mail
address.
- Using Redemption :-)

I have used this line to loop recipients
PrSMTPAddress = &H39FE001E
SMTPAddress =
utils.HrGetOneProp(MailItem.Recipients(t).AddressE ntry.MAPIOBJECT,
PrSMTPAddress)

And everything is working fine.

But when I try to do the following :

PrSMTPAddress = &HC1F001E
SMTPAddress = utils.HrGetOneProp(MailItem.MAPIOBJECT, PrSMTPAddress)

for the Exchange sender, I only get address like this :
/O=server/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=name

for external senders the mail address is ok :-)


Do any one have a clue ?

--
Regards
OD



  #5  
Old March 6th 09, 04:08 PM posted to microsoft.public.outlook.program_vba
juacasco
external usenet poster
 
Posts: 1
Default Reading SMTP address from Exchange Sender mail address

i-ve used tthe following code in outlook 2007 and i worked great!

MsgBox fnGetSMTPAddress("/O=CNPJCO/OU=CLAC/CN=RECIPIENTS/CN=1057003")

Public Function fnGetSMTPAddress(ExchangeMailAddress As String) As String
Dim objOutlook As Outlook.Application
Dim objMailItem As Outlook.MailItem

Set objOutlook = New Outlook.Application
Set objMailItem = objOutlook.CreateItem(0)
objMailItem.To = ExchangeMailAddress
objMailItem.Recipients.ResolveAll
On Error Resume Next
If objMailItem.Recipients.Item(1).Resolved Then
fnGetSMTPAddress =
objMailItem.Recipients.Item(1).AddressEntry.GetExc hangeUser.PrimarySmtpAddress
If Err.Number 0 Then fnGetSMTPAddress = ExchangeMailAddress
Else
fnGetSMTPAddress = ExchangeMailAddress
End If
Set objMailItem = Nothing
Set objOutlook = Nothing

End Function

I hope it is useful 4 u...


"VebKol" wrote:

Hi

I'm facing problems getting SMTP address from Exchange sender mail address.
- Using Redemption :-)

I have used this line to loop recipients
PrSMTPAddress = &H39FE001E
SMTPAddress =
utils.HrGetOneProp(MailItem.Recipients(t).AddressE ntry.MAPIOBJECT,
PrSMTPAddress)

And everything is working fine.

But when I try to do the following :

PrSMTPAddress = &HC1F001E
SMTPAddress = utils.HrGetOneProp(MailItem.MAPIOBJECT, PrSMTPAddress)

for the Exchange sender, I only get address like this :
/O=server/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=name

for external senders the mail address is ok :-)


Do any one have a clue ?

--
Regards
OD

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't get SMTP address of contact that shares email address of an Exchange user Jeff Outlook and VBA 14 January 15th 09 12:50 AM
SMTP address of Exchange recipient Bill Outlook and VBA 5 August 8th 07 07:44 PM
how to make all email address in my address book "safe sender"? ay Outlook - General Queries 3 March 6th 07 10:05 PM
Move mail from if sender is specified in a address book Outlook 20 Carlos Outlook - Installation 0 November 21st 06 09:31 AM
Add every sender of mail in a folder to a address book group? Neil Outlook - Using Contacts 2 August 25th 06 08:17 PM


All times are GMT +1. The time now is 03:13 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.