|
-
Jun 18th, 2003, 01:27 PM
#1
Thread Starter
Lively Member
Extracting an SMTP address!
Hi fellas.
Not sure if this should be in the VB Script area or not..
Basically. Want to look in the inbox of Outlook 2000. Find any emails that have been sent from [email protected]. Then grab the smtp email address of the To field and then stuff it into a distribution list call tiddlytesters.
Not done this at all before...any pointers please??
Thanks
B
-
Jun 19th, 2003, 03:12 AM
#2
Thread Starter
Lively Member
Pretty please any ideas?
B
-
Jun 20th, 2003, 06:05 AM
#3
Frenzied Member
Which bit do you need help with???
Running a macro in Outlook?
Linking from a VB program to Outlook?
Looking through the Inbox of Outlook?
Finding the messages you want?
Getting the TO field?
Getting the SMTP address from the TO field?
VB Code:
set OL = GetObject(,"OUTLOOK.APPLICATION")
set MAPI = OL.GetNamespace("MAPI")
Set myItems = MAPI.GetDefaultFolder(6).Items
For each ThisItem in MyItems
ThisItem.Display
Next
Set myItems = Nothing
Set MAPI = Nothing
Set OL = Nothing
-
Jun 20th, 2003, 11:19 AM
#4
Thread Starter
Lively Member
Hi chris.
Looking to get the SMTP address out of the To field in Outlook...then stuffing it into an outlook/exchange disti list.
Thanks
B
-
Jun 23rd, 2003, 06:43 AM
#5
Frenzied Member
>>Looking to get the SMTP address out of the To field in Outlook...then stuffing it into an outlook/exchange disti list.
So we can assume that you have the code that steps through all the messages you want....
You now have a message, and you want to get the TO field from it.
Have you looked at the MyItem.TO property? BUT the TO property may well show the display name, rather than the SMTP address.
You might find that you need to look through the Recipients collection within the message item, rather than look at the TO property.
Adding it into a Distribution List:
The HELP in Outlook says:
This Microsoft Visual Basic/Visual Basic for Applications example creates a new distribution list and adds the current user to the list.
VB Code:
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myDistList As Outlook.DistListItem
Dim myTempItem As Outlook.MailItem
Dim myRecipients As Outlook.Recipients
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myDistList = myOlApp.CreateItem(olDistributionListItem)
Set myTempItem = myOlApp.CreateItem(olMailItem)
Set myRecipients = myTempItem.Recipients
myDistList.DLName = _
InputBox("Enter the name of the new distribution list")
myRecipients.Add myNameSpace.CurrentUser.Name
myDistList.AddMembers myRecipients
myDistList.Display
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|