Using A Rule To Forward An Email Containing Specific Word

Not open for further replies.


Hello, I am using OL2007 to create a rule to forward email with certain words in the subject line to another recipient. However, in our case the subject lines of the emails we receive are very long, they include things such as Project Number, Location, Email content and etc. The problem is for example, I setup this rule that says any email with 5596 Dallas in the subject to forward to someone else. OK, well the actual subject of the email is 5596-198 Dallas, TX (78XX): Lots of text here describing the email (more numbers here, etc, etc) Now all of this information EXCEPT that first number and Dallas will be changing with every email coming in so we can't include that whole thing. If I use 5596-198 Dallas, TX as my criteria the rule will work, however if I use 5596 Dallas the ruke won't work. I can't use 5596-198 Dallas, TX because the 198 number will be different on every email and sometimes TX or the state is not included. Any advice??


How do I add the logical AND operator, this would solve the issue....

G North


It cannot be done with one rule. However you can do it with two.

The first rule looks for Dallas and assigns it to the Category Dallas.

The second rule looks for 5596 in messages with the Dallas category and forwards all matches.

As long as the rules run in this order and the text your searching for never appears anywhere else in your long subject you should be fine.

It does mean two rules not one but the result should be what you want.

G North MMI



Another client-side rule that you can run would involve using Run a script.

'DISCLAIMER: This is meant only as an example is not intended to be used in a production environment and is not supported by Microsoft in any manner whatsoever.

'Insert a Module in the Visual Basic Editor from Outlook. This is what the rule wizard will display in the Run this script listbox.

'Paste into the pane to the right.

Sub MailRule(olMail As Outlook.MailItem)

Dim fwMail As Outlook.MailItem

If InStr(olMail.Subject, "5596") Then
If InStr(olMail.Subject, "Dallas") Then
olMail.Categories = "Dallas" 'assigns the category
olMail.Save 'saves the cat to the mail
Set fwMail = olMail.Forward 'creates the forwarding mail
End If
End If

Set fwMail = Nothing

End Sub

'Save it --File | Save VBAPorject.

' Create rule on Arriving mail > Sent to me > Run this Script

Anyways, using two rules to achieve the desired result is what I would suggest, too. Unless you don't get scared off by using code to filter out the Subject line. :)

Take care,

Jahawk MSFT
Not open for further replies.
Thread starter Similar threads Forum Replies Date
A Forward Outlook Email by Filtering using Macro Rule Outlook VBA and Custom Forms 44
1 Outlook's Rules Wizard; No 'Forward using a specific template' Rule Using Outlook 4
Diane Poremsky Create a Task from an Email using a Rule New Articles 0
O VBA rule on multiple computers using shared mailbox Outlook VBA and Custom Forms 1
S using script rule to save attachments on arrival Outlook 2010 Outlook VBA and Custom Forms 9
J Autoforward emails to different contacts based on certain criteria using only one rule Using Outlook 1
A Creating rule to create week folder and transfer mail using alert Using Outlook 3
S Using "start application" rule action Using Outlook 2
G Creating an Outlook Rule using Internet Header time Using Outlook 1
D Update existing rule using VBA Using Outlook 2
F Outlook Rule using message header not working Using Outlook 2
C Have server reply using a specific message rule not working Using Outlook 4
williamlambton Setting up a Rule for Hotmail using Outlook 2007. Using Outlook 1
E Prevent Looping Message using transport rule Exchange Server Administration 4
K Organize using colors: rule not applied when my name is in a long list in the 'To' field Using Outlook 7
D How do I run a rule by using a toolbar icon? Outlook VBA and Custom Forms 4
K Re: Cuestom outlook rule using vba Outlook VBA and Custom Forms 4
pcunite Outlook 2019/O365 Build 13127.20408 errors when using MAPI calls Using Outlook 1
B Change Font and Font size using VBA Outlook VBA and Custom Forms 9
M Outlook 2013 reminder email by using Outlook vba Outlook VBA and Custom Forms 2
X Using Outlook 2013 and Outlook 365 Using Outlook 1
A Going to folder using shortcuts Using Outlook 3
A Outlook replies not using "delivered to" address in From Using Outlook 1
Terry Sullivan E-Mails Sent Using a Group Box Result in 70 Kickbacks Using Outlook 5
O Email not leaving Outbox when using Excel VBA to sync Outlook account Outlook VBA and Custom Forms 4
K Using Outlook 2016 to draw Using Outlook 1
O Outlook 365 - suddenly unable to send using Gmail POP3 Using Outlook 10
N Disable Auto Read Receipts sent after using Advanced Find Using Outlook 4
G Outlook 2016 sync contacts directly between phone and computer using outlook 2016 Using Outlook 0
L Moving emails with similar subject and find the timings between the emails using outlook VBA macro Outlook VBA and Custom Forms 1
O Save attachments using hotkey without changing attributes Outlook VBA and Custom Forms 1
J Add an Attachment Using an Array and Match first 17 Letters to Matching Template .oft to Send eMail Outlook VBA and Custom Forms 2
A Edit subject - and change conversationTopic - using VBA and redemption Outlook VBA and Custom Forms 2
A Using or not using apostrophes in search terms has this changed? Using Outlook 0
O Office 365 using POP3 on both laptop and desktop Using Outlook 0
M Using field names to capture a data element Using Outlook 0
B Vba to monitor time to respond to emails using a shared mailbox Outlook VBA and Custom Forms 5
B Looking to get the Recipient email address (or even the "friendly name") from an email I am replying to using VBA Outlook VBA and Custom Forms 4
D Using a VBA Custom Form to Send Reoccurring Email Upon Task Completion Outlook VBA and Custom Forms 4
Z Adding dropdown list using custom form Outlook VBA and Custom Forms 7
O Using .OST and .PST mail thru different providers Using Outlook 5
N Open & Save VBAProject.Otm using VBA Code Outlook VBA and Custom Forms 1
D Remove text in subject using VBA Outlook VBA and Custom Forms 4
P How to export voting results using VBA? Outlook VBA and Custom Forms 2
E Using the Like operator properly Outlook VBA and Custom Forms 1
R Using "check for duplicates" for existing contacts Using Outlook 2
S Find a cell value in excel using outlook vba Using Outlook 1
N Using email notification to update calendar events? Outlook VBA and Custom Forms 4
S Macro using .SendUsingAccount only works the first time, after starting Outlook Outlook VBA and Custom Forms 4
C Sync Calendars using WiFI Using Outlook 3
Similar threads