Run a Script Rule: Send a new message when a message arrives

Last reviewed on April 16, 2013

How to use a Run a Script rule to have Microsoft Outlook automatically send a new email message using a template, to a new email addresses when a message meeting specific conditions arrives. I also have a version of the script that sends a new message with the body of the message that triggered the rule to another person. (To avoid including the Reply header in the body).

To use, open the VBA Editor and paste the code into ThisOutlookSession. Create a Run a Script rule, selecting this rule.

When you create the template, do not include a signature. Outlook will add the signature when the message is sent. To test the rule without sending messages, change objMsg = Send to ojbMsg = Display. This will open the message form instead of sending it.

New message using a template


Sub SendNew(Item As Outlook.MailItem)

Dim objMsg As MailItem
Set objMsg = Application.CreateItemFromTemplate("C:\path\to\test-rule.oft")

' If the address you want to send to is not saved in the template,

objMsg.Send

End Sub


To reply to the sender using a template

This script could be used for an Out of Office style reply. Using this method will send a reply with every message that meets the condition of the rule.


Sub SendNew(Item As Outlook.MailItem)

Dim objMsg As MailItem
Set objMsg = Application.CreateItemFromTemplate("C:\path\to\test-rule.oft")

' Copy the original message subject
objMsg.Subject = "Attn: " & Item.Subject

objMsg.Send

End Sub



To Forward the message body to another address

This version of the script sends a new message containing the body of the received message. (If you want to forward the complete message, use the Forward rule.)

Hyperlinks links will be "opened". To avoid this, and if you don't mind converting the messages to HTML, you can use objMsg.HTMLBody = Item.HTMLBody instead (it works with plain text and RTF messages), or create an If Then statement to check for incoming body types and use the correct format. As always, test it with messages to yourself or using objMsg.Display before using it to send messages to others.


Sub SendNew(Item As Outlook.MailItem)

Dim objMsg As MailItem
Set objMsg = Application.CreateItem(olMailItem)

objMsg.Body = Item.Body
objMsg.Subject = "FW: " & Item.Subject