In this article, your will learn how to enable a warning banner to external emails in Office 365. I will provide you with the html code that you can easily modify the background colors and the warning message.
What is an Email Warning Banner
An email warning banner is simply a visual message added to emails, typically to the top of an email. The most popular use case is to add a warning message to all emails that are received from an external sender. By alerting users the email came from outside the organization it can help users be more cautious, prevent phishing attacks and data loss.

Create a Warning Banner Using Exchange Mail flow Rules
In this example, I will do the following:
- Set the rule to be applied for users outside of the organization
- Create a Specified Prefix with the word External
- Create the warning banner
- Exclude a user from the rule
- You can customize the rules as you need, for example you can change Prepend a disclaimer to Append a disclaimer if you would like the warning under the email instead of above it
Step 1: Sign into the Exchange Admin Center
Step 2: On the left, navigate to Mail flow > Rules.

Step 3: Select “Add a Rule” then from the drop down click “Create a new rule”

Step 4: Set the rules and conditions for the rule
First create a name for the rule.

Next, under “Apply this rule if” Select The Sender and is external/internal, then Select Outside this Organization.

Note: This next step will add the word “External” to the subject of the email. This will help you identify the message is external before you even open the email. This step is optional.
Now under “Do the following” select prepend the subject of the message with then select specified prefix and type “External”.

Then select the + button in the “Do the following” tab.

After that, under the new column added select Apply a disclaimer message and prepend a disclaimer.

Now select “Enter text” in the blue font to write your warning message.
If you want the warning disclaimer to stand out more with color, you will need to use a disclaimer code.
Here is the code I am using.
<table border=0 cellspacing=0 cellpadding=0 align=left width=`"100%`">
<tr>
<td style='background:#bba555;padding:5.25pt 5.5pt 5.25pt 1.5pt'></td>
<td width=`"100%`" style='width:100.0%;background:#ffe599;padding:5.25pt
3.75pt 5.25pt 11.25pt; word-wrap:break-word' cellpadding=`"7px 5px 7px
15px`" color=`"#212121`">
<div><p><span style='font-size:11pt;font-family:Arial,sans-serif;color:
#212121'>
<b>CAUTION:</b> This email originated from outside the organization.
Do not click links or open attachments unless you recognize the sender
and know the content is safe.
</span></p></div>
</td></tr></table>

If you want to change the background color of the banner change these two values.

Green Warning Banner

HTML code for green warning banner:
<table border=0 cellspacing=0 cellpadding=0 align=left width=`"100%`">
<tr>
<td style='background:#A3D9A5;padding:5.25pt 5.5pt 5.25pt 1.5pt'></td>
<td width=`"100%`" style='width:100.0%;background:#A3D9A5;padding:5.25pt
3.75pt 5.25pt 11.25pt; word-wrap:break-word' cellpadding=`"7px 5px 7px
15px`" color=`"#`">
<div><p><span style='font-size:11pt;font-family:Arial,sans-serif;color:
#212121'>
<b>CAUTION:</b> This email originated from outside the organization.
Do not click links or open attachments unless you recognize the sender
and know the content is safe.
</span></p></div>
</td></tr></table>
Red Warning Banner

HTML code for red warning banner:
<table border=0 cellspacing=0 cellpadding=0 align=left width=`"100%`">
<tr>
<td style='background:#E66A6A;padding:5.25pt 5.5pt 5.25pt 1.5pt'></td>
<td width=`"100%`" style='width:100.0%;background:#E66A6A;padding:5.25pt
3.75pt 5.25pt 11.25pt; word-wrap:break-word' cellpadding=`"7px 5px 7px
15px`" color=`"#`">
<div><p><span style='font-size:11pt;font-family:Arial,sans-serif;color:
#212121'>
<b>CAUTION:</b> This email originated from outside the organization.
Do not click links or open attachments unless you recognize the sender
and know the content is safe.
</span></p></div>
</td></tr></table>
(Recommended) – To add space between your warning message and the email received put this code at the bottom of your html code.
<p> </p>

Example with the spacing code

Example without the spacing code

Next, Click the “Select one” in a blue font and select Wrap

If you want to exclude certain users from this rule, under “Expect if” select the recipient then select the user or users you want excluded from this rule.

Step 5: Set rule settings
Set the settings to your preferred conditions

Step 6: Review rules and select finish.

Select finish at the bottom of the review page.
Step 7: Enable the Rule
Finally, select the rule you created in your list of rules. On the right side pop up you will see Enable or disable rule and select

Here is an example of the warning being displayed when receiving an email.

Conclusion
Adding a warning banner to all external emails will help your users be more cautious when interacting with emails. It is useful to help remind users that the email could be malicious and if you did not expect the email or do not recognize the sender then don’t click on any links or attachments.
With the flexibility of the Exchange mail flow rules, you can customize the warning banner to apply on all emails or specific emails such as those that contain certain words. In addition, you can customize the warning message to say anything you want, you can modify the html and change the colors as needed.