When you reply to an email in Outlook, the message format usually matches the original email. But if you regularly correspond with a specific domain that requires plain text replies, you may want to automate this setting. Outlook does not offer a built-in per-domain reply format rule. However, you can achieve this by combining a custom Outlook rule with a Visual Basic for Applications script. This article explains how to create a rule that detects replies to a specific domain and forces the reply to plain text format.
The core solution uses an Outlook rule that triggers a VBA script. The script checks the recipient domain of the reply and changes the email format to plain text before sending. You will need to enable macros in Outlook and trust the VBA project. This guide walks through each step to set up the rule and script.
By the end of this article, you will have a working rule that automatically converts replies to plain text for any recipient domain you specify. You can modify the domain list in the script to add or remove domains as needed. This method works in Outlook 2016, Outlook 2019, Outlook for Microsoft 365, and Outlook 2021 on Windows 10 and Windows 11.
Key Takeaways: Force Plain Text Reply by Domain
- Outlook Rule + VBA Script: The only way to force plain text reply format based on recipient domain without third-party add-ins.
- Alt+F11: Opens the VBA editor where you paste the script that checks domain and sets MailItem.BodyFormat to olFormatPlain.
- File > Options > Trust Center > Trust Center Settings > Macro Settings: Enable all macros and trust access to the VBA project object model.
- Rule with “run a script” action: Triggers the VBA script on every outgoing reply you send to the specified domain.
How the Outlook Rule and VBA Script Work Together
Outlook rules can perform actions automatically when you send or receive messages. One available action is to run a VBA script. When you create a rule that triggers on outgoing replies, you can attach a script that inspects the recipient domain and changes the message format to plain text. The script runs before the email leaves your Outbox, so the recipient receives a plain text message even if the original email was HTML or Rich Text.
The VBA script uses the Application_ItemSend event or a rule-triggered Sub to intercept the outgoing item. In this guide, we use a rule-triggered script because it allows you to specify exactly which domain triggers the format change. The script checks the recipient email address domain and sets the BodyFormat property to olFormatPlain (value 1). It also converts the HTML body to plain text by stripping tags, ensuring no formatting artifacts remain.
Prerequisites: You need administrative rights to your Windows user account to enable macros in Outlook. The VBA project is stored in your Outlook profile, so the rule and script apply only to your local Outlook client. This method does not work in Outlook on the web or on mobile devices.
Steps to Create the Plain Text Reply Rule for a Specific Domain
Follow these steps to create a rule and a VBA script that forces plain text replies for a specific domain. Replace example.com with your target domain in the script.
Step 1: Enable Macros in Outlook
- Open Trust Center
Go to File > Options > Trust Center. Click Trust Center Settings. - Change Macro Settings
Select Macro Settings. Choose “Enable all macros (not recommended; potentially dangerous code can run)”. Check the box “Trust access to the VBA project object model”. Click OK twice.
Step 2: Open the VBA Editor and Insert the Script
- Open VBA Editor
Press Alt+F11 in Outlook. If the Project Explorer is not visible, press Ctrl+R to show it. - Insert a New Module
In the Project Explorer, expand Project1 (VbaProject.OTM). Right-click Modules, choose Insert > Module. A blank module opens. - Paste the Script
Copy and paste the following VBA code into the module. Replaceexample.comwith your target domain. To add multiple domains, useOr InStr(recipient, "@domain2.com") > 0.Sub ForcePlainTextReply(Item As Outlook.MailItem) Dim recipient As String Dim i As Integer ' Check if the item is a reply If Item.ReplyRecipients.Count = 0 Then Exit Sub ' Loop through reply recipients For i = 1 To Item.ReplyRecipients.Count recipient = LCase(Item.ReplyRecipients.Item(i).Address) ' Check if recipient domain matches target If InStr(recipient, "@example.com") > 0 Then ' Set format to plain text Item.BodyFormat = olFormatPlain ' Convert HTML body to plain text Item.Body = Item.Body Exit For End If Next i End Sub - Save and Close
Press Ctrl+S to save. Close the VBA editor.
Step 3: Create the Outlook Rule
- Open Rules Wizard
Go to File > Manage Rules & Alerts. Click New Rule. - Select Template
Under “Start from a blank rule”, select “Apply rule on messages I send”. Click Next. - Set Conditions
Check “sent only to me”. This ensures the rule triggers only on replies or forwards where you are in the To field. Click Next. Click Yes when prompted about exceptions. - Select Action
Check “run a script”. In the lower pane, click the underlined “a script”. Select “ForcePlainTextReply” from the list. Click OK. Click Next. - Set Exceptions
Leave exceptions empty. Click Next. - Name and Finish
Enter a name like “Force Plain Text Reply to example.com”. Check “Turn on this rule”. Click Finish. Click OK.
If the Rule Does Not Apply or the Script Fails
The rule and script combination is reliable, but several issues can prevent it from working. Here are the most common problems and how to fix them.
The script does not run when I reply to emails from the target domain
The rule condition “sent only to me” may be too restrictive. If you reply to an email where the original sender is not in your address book or the reply recipient is not in the To field, the rule may not trigger. Change the condition to “sent to people or distribution list” and select your own email address. Alternatively, remove conditions entirely so the rule applies to all outgoing messages, and let the script filter by domain.
Macro security blocks the script
If you see a security warning about macros, the script will not run. Go to File > Options > Trust Center > Trust Center Settings > Macro Settings. Ensure “Enable all macros” is selected and “Trust access to the VBA project object model” is checked. Also, add your VBA project as a trusted location: in Trust Center, select Trusted Locations, add a location pointing to your Outlook VBA project file (usually in %appdata%\Microsoft\Outlook).
The email still sends in HTML or Rich Text format
The script may not run because the rule action “run a script” requires that the script is in a module, not in the ThisOutlookSession code pane. Confirm the script is in a standard module (Modules folder). Also, the script uses Item.ReplyRecipients which may be empty for new replies composed from the Inbox. In that case, modify the script to check Item.To instead of reply recipients. Replace the loop with:
If InStr(LCase(Item.To), "@example.com") > 0 Then
Item.BodyFormat = olFormatPlain
Item.Body = Item.Body
End If
Rule-Triggered Script vs ItemSend Event: Key Differences
The method described in this article uses a rule-triggered script. Another approach uses the Application_ItemSend event which fires on every outgoing message. The table below compares the two approaches.
| Item | Rule-Triggered Script | Application_ItemSend Event |
|---|---|---|
| Trigger mechanism | Outlook rule with “run a script” action | Event handler in ThisOutlookSession |
| Domain filtering | Script checks recipients and applies format | Script checks recipients and applies format |
| Setup complexity | Requires creating a rule and a module script | Requires only code in ThisOutlookSession |
| Scope | Applies only to messages matching rule conditions | Applies to all outgoing messages |
| Performance impact | Low; only runs when rule conditions are met | Runs on every send; slight delay |
| Best for | Specific domains or limited use cases | Global format enforcement |
The rule-triggered script is better for targeting a specific domain because it runs only when the rule conditions match. The ItemSend event runs on every outgoing message, which can slow down sending if you have many emails. For the use case of forcing plain text for one domain, the rule-triggered script is the recommended approach.
After setting up the rule and script, test by sending a reply to an email from the target domain. Compose a reply in HTML format, then send it. The recipient should receive a plain text message. To verify, send a test email to yourself using an account from the target domain and check the message format in your Inbox.
You can extend the script to support multiple domains by adding more Or InStr conditions. For example: If InStr(recipient, "@example.com") > 0 Or InStr(recipient, "@test.org") > 0 Then. You can also modify the script to force plain text on new messages, not just replies, by removing the reply recipient check and always checking the To field.