This macro will reply to the person who sent the message. It includes the original message, any text entered by in the macro, plus the content of the template.
Because this is a run a script rule, all messages meeting the condition will be replied to, unlike the autoreply rule which is one message per Outlook session.
If you want to include the original subject, use (or add) item.subject to the .Subject field, otherwise, this should have most of the bases covered and point you in the right direction for things I didn't include. Remove the parts you don't need and you should be good to go....
Keep in mind that the original message is Item, from Item As Outlook.MailItem. oRespond is the message you are sending back. You need to use the Item fields if you want to include fields from the original message in the response.
Sub AutoReplywithTemplate(Item As Outlook.MailItem) Dim oRespond As Outlook.MailItem ' Use this for a real reply ' Set oRespond = Item.Reply ' This sends a response back using a template Set oRespond = Application.CreateItemFromTemplate("C:\path\to\template.oft") With oRespond .Recipients.Add Item.SenderEmailAddress .Subject = "Your Subject Goes Here" .HTMLBody = "Your reply text goes here." & vbCrLf & _ "---- original body below ---" & vbCrLf & _ Item.HTMLBody & vbCrLf & _ "---- Template body below ---" & _ vbCrLf & oRespond.HTMLBody ' includes the original message as an attachment .Attachments.Add Item ' use this for testing, change to .send once you have it working as desired .Display End With Set oRespond = Nothing End Sub
More Run a Script Samples:
- Autoaccept a Meeting Request using Rules
- Forward meeting details to another address
- How to Change the Font used for Outlook's RSS Feeds
- Keep Canceled Meetings on Outlook's Calendar
- Move messages CC'd to an address
- Outlook's Rules and Alerts: Run a Script
- Process messages received on a day of the week
- Read Outlook Messages using Plain Text
- Run a Script Rule: Change Subject then Forward Message
- Run a Script Rule: Send a new message when a message arrives
- Save Outlook email as a PDF
- Use a run a script rule to mark messages read