Hello
As some of you may know when using MAPI or Outlook to send emails. When you try to extract the email address out of the email it either shows you the name of the person or the exchange server name & name & id and random stuff see below.
Name = Iles, Kevin
Email = EX:/o=CorpLAN/ou=First Administrative Group/cn=Recipients/cn=IlesK
I am using MAPI to send emails and using the 'name' to send emails is fine as the name can be resolved by the address book. Which is good.
And some of you may also know you cannot send HTML Emails using Simple MAPI, so what i am doing instead is using SMTP to send out HTML Emails.
One problem, if im reading emails from MAPI and sending with SMTP, the only names i can get are the ones listed above. Inside the profile is a POP3 address that emails can be sent to (for use by external people) so what i need is to get the POP3 Email. After allot of searching i have finally found some code that does this
This is a console application.
## With reference to
Microsoft CDO 1.21 Library
Code:
Imports Microsoft.Office.Interop
Module Module1
Const CdoPR_EMS_AB_PROXY_ADDRESSES = &H800F101E
Sub main()
Dim objSession As MAPI.Session
Dim objMessage As MAPI.Message
Dim objRecip As MAPI.Recipient
Dim objField As MAPI.Field
Dim v
objSession = CreateObject("MAPI.Session")
objSession.Logon("Outlook")
objMessage = objSession.Outbox.Messages.Add
objMessage.Recipients = objSession.AddressBook(OneAddress:=True)
objRecip = objMessage.Recipients(1)
MsgBox("Display Name: " & objRecip.Name)
MsgBox("Default Address: " & objRecip.Address)
objField = _
objRecip.AddressEntry.Fields(CdoPR_EMS_AB_PROXY_ADDRESSES)
For Each v In objField.Value
MsgBox("Foreign System Address: " & v)
Next
objSession.Logoff()
End Sub
End Module
this does exactly what i want. it pops up and allows you to select a user/profile to load, then it will tell you the
Name
Exchange Email
All POP3 Email accounts.
Which is excellent. but the problem is the 'Popup' where it allows you to select a user/profile.
That is done by this line
Code:
objMessage.Recipients = objSession.AddressBook(OneAddress:=True)
What i want to be able to do is be able to tell which profile / name to load.
I have tried on various other websites and Google but nothing that instantly jumps out at me and says 'Put name/profile' name here.
So if you could take a look, and possibly help me figure out what i need to do to do this. Either by a simple line of code. Or by taking control of the window its self and adding data in and submitting the popup.
Many thanks for any help in advance.
Also posted on:
http://www.xtremevbtalk.com/showthread.php?t=289552
But got no answer from these guys :(
Kev