Solved

Outlook 2010

Posted on 2011-02-11
18
338 Views
Last Modified: 2012-05-11
Hi.  I'm trying to set a rule to check all incoming mail for addresses NOT in my own contacts. If I don't hold an email address from the sender I would like Outlook to open a new contact window and therefore prompt me to add them.  Any help appreciated.
0
Comment
Question by:Tocogroup
  • 9
  • 7
  • 2
18 Comments
 
LVL 4

Expert Comment

by:RyanShafer
ID: 34872736
You cannot easily create a rule however it is so easy to add contacts in outlook 2010 why would you.  

1.  You can simply drag the mail to the contacts section on the navigation pane and a new contact form partially completed opens.

2.  You can also right click the senders name in the preview pane and choose add to contacts.

It will tell you if the contact already exists and you can choose to create a new contact or simply update the existing one.
0
 

Author Comment

by:Tocogroup
ID: 34873091
Hi there, many thanks for the ideas and yes I agree it does seem like a strange request.  

However my quest is to try and save time by not having to guess whether I do or do not already have them in my contacts. A large volumne of email comes my way and I was hoping to automate the process rather than doing either of the above only to be told they already exist.

Appreciate your help.
Toco
0
 
LVL 4

Expert Comment

by:RyanShafer
ID: 34873491
The problem is that with such a rule the contact will popup for all email that is not in contacts, even ones that are from newsgroups etc.  In the longrun these popups will cause you to lose more time by having to cancel ones you don't want.  When you drag to contacts it informs if they are already in your contacts or not.  Manually adding ones will actually save time in the long run or will at least be the same time.  This is the main reason why the feature is not available without manually scripting it.
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34915251
Via a rule and some script we can look at any SMTP addresses that are in the senders email and add them as contacts either saving without user interaction or leaving the contact open for you to edit ... if that is the wish?

Chris
0
 

Author Comment

by:Tocogroup
ID: 34915264
How would I do that Chris ?
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34915380
We can provide a script so before then lets set the ground rules!

Macros need to be acceptable - enabled
You need to create a rule to run a script with guidance if nedessary
You need to add some code we supply, again with guidance if required.

The code would run on every received email
The code will save every contact using the email name as a new contact, (unless already found) and you will need to look to open them and edit when it suits you.

The logic here is then that the contacts are saved without holding the screen up for all the edits and you can look to edit them periodically.

The contact fullname can be for example "newbie 1, newbie 2 etc to help them stand out if you would like or pretty much anything else.

If this is ok i'll look to put some code up for you.

Chris
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34915470
Just tested some code to do it ... adding an incremental number will be fiddly so if agreeable all such 'new' contacts would have a constant fullname of your choosing ... for you to edit when opportunity permits

Chris
0
 

Author Comment

by:Tocogroup
ID: 34915517
Yes, that all sounds fine. So the name constant will serve for all incoming mail from new contacts /
0
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 500 total points
ID: 34915641
Yes so 23 new contacts will mean 23 new contacts named "Please Name ME" ... or whatever you change that string to.

The code is below and your rule that you create needs to call the code routine rule_1, (run a script when defining the rule)

Chris


To Create a macro:
------------------

Alt + F11 to open the macro editor

  For User Code:
     Insert | Module to insert a code module into the project
     In the project tree select the module.
     Insert the required macro(s) into the selected module, ('Module1' or similar)

Close the Visual Basic Editor.


Function findContact(streMail As String) As ContactItem
Dim conFolder As MAPIFolder
Dim strFilter As String
Dim olkContactItems As items
Dim con As ContactItem
Dim intCountItems As Integer
Dim intDelCount As Integer

    Set conFolder = Application.Session.GetDefaultFolder(olFolderContacts)
    strFilter = "[email1address] = " & Chr(34) & streMail & Chr(34)
    Set olkContactItems = conFolder.items.Restrict(strFilter)
    If olkContactItems.count <> 0 Then
        Set findContact = olkContactItems.GetFirst
    Else
        strFilter = "[email2address] = " & Chr(34) & streMail & Chr(34)
        Set olkContactItems = conFolder.items.Restrict(strFilter)
        If olkContactItems.count <> 0 Then
            Set findContact = olkContactItems.GetFirst
        Else
            strFilter = "[email3address] = " & Chr(34) & streMail & Chr(34)
            Set olkContactItems = conFolder.items.Restrict(strFilter)
            If olkContactItems.count <> 0 Then
                Set findContact = olkContactItems.GetFirst
            End If
        End If
    End If

End Function

Sub rule_1(mai As MailItem)
Dim con As Object

    If mai.SenderEmailType <> "SMTP" Then Exit Sub
    Set con = findContact(mai.sendereMailAddress)
    If con Is Nothing Then
        Set con = Application.CreateItem(olContactItem)
        con.FullName = "Please Name ME"
        con.Email1Address = mai.sendereMailAddress
        con.Save
    End If
End Sub

Open in new window

0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:Tocogroup
ID: 34916071
I've inserted the code into Module 1 of my Outlook project. How do I create the rule that calls this routine ?
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34916153
File | Info | Manage rules and alerts
New Rule | Apply this rule to messages I receive | Next | Next
Accept the warning about running on all messages
Find run a script ... tick it and click the hyperlink navigating to the rule_1 sub
COntinue with next etc and rename as required and the rule should be established at that time

Chris
0
 

Author Comment

by:Tocogroup
ID: 34916239
Could you also give me the above procedure for Outlook 2007 please Chris. I'm currently running this on my old machine.
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34916371
Not on 2007 here ... I think it is much the same but triggered via tools | rule | new rule

Quick web search says:

In the Navigation Pane, click Mail.
On the Tools menu, click Rules and Alerts.
If you have more than one e-mail account, in the Apply changes to this folder list, click the Inbox you want.
Click New Rule.
0
 

Author Comment

by:Tocogroup
ID: 34916833
I'm getting out of my depth here. The New Rules wizard gives me an error status (see attached screenshots). Doesn't seem to follow the procedure you prescribed for 2010.
SNAG-Program-0004.jpg
SNAG-Program-0005.jpg
SNAG-Program-0006.jpg
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34917376
See start from a blank rule ... CHeck messages when they arrive

In step 2 you will note a line like:

run script ... a hyperlink you should follow saying I think "Script".  Press the hyperlink ad navigate to the code routine.

I can't add piccies ... I don't know how on this machine!

Chris
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34917435
Ignore the path ... the key element is selecting rule 1

Chris
Screen-shot-2011-02-17-at-16.12..png
0
 

Author Closing Comment

by:Tocogroup
ID: 34917897
Oh, after all that...it worked !!
Excellent....it catches new contacts and puts them into my Contacts.
I also ran it against the existing InBox and I go to my Contacts and 'Please Name ME' is there a number of times.

Thanks very much for your efforts
Toco
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34918463
:o)

Always a pleasure when a solution hits the spot!

Chris
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Get an idea of what you should include in an email disclaimer with these Top 5 email disclaimer tips.
Set OWA language and time zone in Exchange for individuals, all users or per database.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now