Auto create folder based on subject or body text

G

Guest

Does anyone know how to program a rule into Outlook so it will create a
subfolder based on something in the message subject or body? Like if I had a
fruit vendor send me an email based on apples, I would have a rule create a
subfolder named apples and move the emails with apples in the subject line to
that folder. The next day he sends me something about bananas so Outlook
creates a bananas subfolder and moves the email there. Obviously the fruit
vendor and I would agree on a standard for sending emails to do this.
 
G

Guest

We are on Exchange 2003 and have mixed Outlook 2002/2003 installs. We only
need one mailbox to do this, and it currently has 2003 installed but we could
do 2002 if necessary.
 
G

Guest

I suppose it doesn't really matter where the rule or code occurs. Right now
we have a program called Notice Organizer Pro that does this for us on an
Outlook 2003 install, but the program is messing up and is discontinued. I
would also like to be able to delete the folders created if they remain empty
for x amount of time.
 
M

Michael Bauer

It does matter. If the code runs on the server then you will be able to
catch every message. If not then it´s necessary that OL is running.

For the OL side solution: For handling each incoming mail you can use
the Inbox´ ItemAdd event. (These event won´t fire if there are more than
16 items coming in at once).

For searching in the subject or body use the InStr function. If there´s
a match then call the folder´s Folders.Add function to create a
subfolder. Moving the mail works with MailItem.Move.

Please see also the VBA help for samples for the mentioned functions.

A really simple solution for deleting not used folders could be this:
Delete them each time OL starts if the folder is empty (Items.Count=0).
It doesn´t matter if a new e-mail comes in one minute later for that
folder because the folder will be created automatically again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top