<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>MailFlowRule &#8211; Webbanshee</title>
	<atom:link href="https://webbanshee.net/tag/mailflowrule/feed/" rel="self" type="application/rss+xml" />
	<link>https://webbanshee.net</link>
	<description>Your Exchange Server Blog</description>
	<lastBuildDate>Mon, 25 Apr 2022 08:18:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://webbanshee.net/wp-content/uploads/2017/01/WB_BL_RND-150x150.png</url>
	<title>MailFlowRule &#8211; Webbanshee</title>
	<link>https://webbanshee.net</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">122610384</site>	<item>
		<title>Mail Flow Rule Mark External Mail</title>
		<link>https://webbanshee.net/mail-flow-rule-mark-external-mail/</link>
					<comments>https://webbanshee.net/mail-flow-rule-mark-external-mail/#respond</comments>
		
		<dc:creator><![CDATA[WebBanshee]]></dc:creator>
		<pubDate>Wed, 15 Jan 2020 10:45:27 +0000</pubDate>
				<category><![CDATA[Serverside]]></category>
		<category><![CDATA[2013]]></category>
		<category><![CDATA[2016]]></category>
		<category><![CDATA[2019]]></category>
		<category><![CDATA[Exchange]]></category>
		<category><![CDATA[MailFlowRule]]></category>
		<category><![CDATA[Powershell]]></category>
		<guid isPermaLink="false">https://webbanshee.net/?p=3145</guid>

					<description><![CDATA[<p><a class="ex-link" href="https://webbanshee.net/mail-flow-rule-triggered-action"><img src="https://webbanshee.net/wp-content/uploads/2020/01/NewMailFlowRule.svg" /><span class="exTeaser">To filter mails for certain criteria like sender, recipients, domain, header-information and more it makes sense to create a new Mail Flow Rule and associate it with an action of your choice.</span><br />
<span class="exText">In this example we will create a rule that tags mails from external senders with [EXT]<span style="font-size: 11px !Important; width: 10%; height: 5%; color: #993333; padding-left: 20px;">......read more</span></span></a></p>
<p>The post <a rel="nofollow" href="https://webbanshee.net/mail-flow-rule-mark-external-mail/">Mail Flow Rule Mark External Mail</a> appeared first on <a rel="nofollow" href="https://webbanshee.net">Webbanshee</a>.</p>
]]></description>
										<content:encoded><![CDATA[<style type="text/css">/*.entry-content img {border-bottom: 3px solid #F90;}*/h2 {font-weight: bold;text-decoration:none;font-size: 20px!Important;}h3 {font-weight: bold;text-decoration:none;font-size: 18px!Important;}.wp-image-2045,.wp-image-2051,.wp-image-2050,.wp-image-2049,.wp-image-2056, .wp-image-2055 {margin-top:2px!Important;margin-right:6px;}</style>
<p style="text-align: justify;">Hello Folks. To filter mails for certain criteria like sender, recipients, domain, header-information and more it makes sense to create a new Mail Flow Rule ( former Transport Rule ) and associate it with an action of your choice.</p>
<p style="text-align: justify;">You could, for example, use a Mail Flow Rule to pretend [EXT] to the subject when a mail comes from an external sender or you could use a rule to classify emails with certain header-information as SPAM and move them to the user&#8217;s Junk-Mail folder.</p>
<p style="text-align: justify;">Ok, let&#8217;s get into it. In this example we will create a rule that tags mails from external senders with [EXT]:</p>
<div class="wpe-box wpe-box-note3"><strong>&gt; Login to your Exchange Control Panel ( ECP ) with an administrative account.</strong><br />
<span style="display: inline-block; text-indent: 12px;"><strong>The URL should be like that:</strong>  <span style="color: #993333; font-weight: bold;">https://YourExchangeURL/ecp<br />
<a style="font-weight: bold;" href="#powershell">&gt; Or click here to create a new Mail Flow Rule via PowerShell</a><br />
</span></span></div>
<h2><img class="alignnone size-full wp-image-2045" src="https://webbanshee.net/wp-content/uploads/2019/01/round_1.svg" alt="1 -" />Create a new Mail Flow Rule via ECP:</h2>
<div class="wpe-box wpe-box-note3"><span style="font-weight: bold;">&gt; In ECP navigate to mail flow &gt; rules and click the <span style="font-size: 26px; position: relative; top: 3px;">+</span> icon. Choose Create a new rule.</span><br />
<a href="https://webbanshee.net/wp-content/uploads/2020/01/NewMailFlowRule.png"><img loading="lazy" class="aligncenter wp-image-3157 size-large" src="https://webbanshee.net/wp-content/uploads/2020/01/NewMailFlowRule-1024x451.png" alt="New Mail Flow Rule" width="1024" height="451" srcset="https://webbanshee.net/wp-content/uploads/2020/01/NewMailFlowRule-1024x451.png 1024w, https://webbanshee.net/wp-content/uploads/2020/01/NewMailFlowRule-300x132.png 300w, https://webbanshee.net/wp-content/uploads/2020/01/NewMailFlowRule-768x338.png 768w, https://webbanshee.net/wp-content/uploads/2020/01/NewMailFlowRule.png 1053w" sizes="(max-width: 1024px) 100vw, 1024px" /></a><br />
The Drop-Down offers several templates for new rules.<br />
We won&#8217;t use them here since we want to create a new Mail Flow Rule from scratch.</div>
<h3>Specify the name and criteria of the new Mail Flow Rule:</h3>
<p>We will create a rule which pretends [EXT] to the message subject when a mail comes from a sender outside of your organization.</p>
<div class="wpe-box wpe-box-note3"><strong>&gt; Specify the name of the rule</strong><br />
<strong>&gt; Click More options</strong><br />
<a href="https://webbanshee.net/wp-content/uploads/2020/01/NameMailFlowRule.png"><img loading="lazy" class="aligncenter size-medium wp-image-3164" src="https://webbanshee.net/wp-content/uploads/2020/01/NameMailFlowRule-300x296.png" alt="Name Mail Flow Rule" width="469" height="463" srcset="https://webbanshee.net/wp-content/uploads/2020/01/NameMailFlowRule-300x296.png 300w, https://webbanshee.net/wp-content/uploads/2020/01/NameMailFlowRule.png 469w" sizes="(max-width: 469px) 100vw, 469px" /></a></p>
<div class="wpe-box wpe-box-alert-orange">
<p><span style="font-weight: bold; font-size: 18px; text-decoration: underline;">For an Exchange environment hosting a single tenant:</span></p>
<p><strong>&gt; Under Apply this rule if choose The sender&#8230; &gt; is external/internal </strong><br />
<strong>&gt; Set it to Outside the organization<br />
&gt; Add another condition<br />
&gt; Choose The recipient&#8230; &gt; domain is<br />
&gt; Add the domain for which you want to mark external mails<br />
&gt; Under Do the following&#8230; choose Prepend the subject of the message with&#8230;<br />
&gt; Enter your preferred tag ( e.g. [EXT] )</strong></p>
<p><a href="https://webbanshee.net/wp-content/uploads/2020/01/MailFlowRuleConditions_so.png"><img loading="lazy" class="aligncenter size-full wp-image-3166" src="https://webbanshee.net/wp-content/uploads/2020/01/MailFlowRuleConditions_so.png" alt="Mail Flow Rule Single Org" width="619" height="343" srcset="https://webbanshee.net/wp-content/uploads/2020/01/MailFlowRuleConditions_so.png 619w, https://webbanshee.net/wp-content/uploads/2020/01/MailFlowRuleConditions_so-300x166.png 300w" sizes="(max-width: 619px) 100vw, 619px" /> </a></p>
<p><strong>&gt; Further down set Match sender address in message to &gt; Envelope</strong><br />
<a href="https://webbanshee.net/wp-content/uploads/2020/01/MatchEnvelope.png"><img loading="lazy" class="aligncenter size-full wp-image-3194" src="https://webbanshee.net/wp-content/uploads/2020/01/MatchEnvelope.png" alt="Mail Flow Rule matches envelope" width="258" height="58" /></a></p>
</div>
<div class="wpe-box wpe-box-alert-orange">
<p><span style="font-weight: bold; font-size: 18px; text-decoration: underline;">For a multi-tenant Exchange environment:</span></p>
<p style="text-align: justify;">Exchange considers a sender to be external if:<br />
• The sender&#8217;s email address isn&#8217;t in an accepted domain.<br />
• The sender&#8217;s email address is in an accepted domain that&#8217;s configured as an external relay domain.</p>
<p style="text-align: justify;">In a multi-tenant environment where tenants send mails between each other, the sender will not be considered as an external sender from the recipient&#8217;s point of view since the sender&#8217;s domain is an accepted domain. This means we cannot use the same conditions as we have used in a single-tenant environment.</p>
<p><strong>&gt; Under Apply this rule if choose The sender&#8230; &gt; address matches any of these text patterns</strong><br />
<strong>&gt; Enter @ as a specified word or phrase<br />
&gt; Add another condition<br />
&gt; Choose The recipient&#8230; &gt; domain is<br />
&gt; Add the domain for which you want to mark external mails<br />
&gt; Under Do the following&#8230; choose Prepend the subject of the message with&#8230;<br />
&gt; Enter your preferred tag ( e.g. [EXT] )<br />
&gt; Under Except if choose The sender &gt; domain is<br />
&gt; Enter one or more domains you don&#8217;t want to be marked as an external sender</strong></p>
<p><a href="https://webbanshee.net/wp-content/uploads/2020/01/MailFlowRuleConditions_multitenant.png"><img loading="lazy" class="aligncenter size-full wp-image-3167" src="https://webbanshee.net/wp-content/uploads/2020/01/MailFlowRuleConditions_multitenant.png" alt="Mail Flow Rule multi-tenant" width="696" height="440" srcset="https://webbanshee.net/wp-content/uploads/2020/01/MailFlowRuleConditions_multitenant.png 696w, https://webbanshee.net/wp-content/uploads/2020/01/MailFlowRuleConditions_multitenant-300x190.png 300w" sizes="(max-width: 696px) 100vw, 696px" /></a><br />
<strong>&gt; Further down set Match sender address in message to &gt; Envelope</strong><br />
<a href="https://webbanshee.net/wp-content/uploads/2020/01/MatchEnvelope.png"><img loading="lazy" class="aligncenter size-full wp-image-3194" src="https://webbanshee.net/wp-content/uploads/2020/01/MatchEnvelope.png" alt="Mail Flow Rule matches envelope" width="258" height="58" /></a></p>
</div>
</div>
<h2 id="powershell"><img class="size-full wp-image-2051 alignnone" role="img" src="https://webbanshee.net/wp-content/uploads/2019/01/round_2.svg" alt="2 -" />Create a new Mail Flow Rule using PowerShell:</h2>
<p><span style="font-weight: bold; font-size: 18px;">For an Exchange environment hosting a single tenant</span></p>
<p>Create a new Mail Flow Rule using the New-TransportRule cmdlet with the following parameters:</p>
<div class="wpe-box wpe-box-white"><strong>New-TransportRule -Name</strong> <span style="color: #993333;">&#8220;Mark mails from external&#8221;</span> <strong>-FromScope</strong> <span style="color: #993333;">NotInOrganization</span> <strong>-RecipientDomainIs</strong> <span style="color: #993333;">testlab.local</span> <strong>-SenderAddressLocation</strong> <span style="color: #993333;">Envelope</span> <strong>-PrependSubject</strong> <span style="color: #993333;">&#8220;[EXT]&#8221;</span> <strong>-Enabled</strong> <span style="color: #993333;">$True</span></div>
<h3>A Short explanation of the used parameters:</h3>
<div class="wpe-box wpe-box-note3"><strong>-Name:</strong><br />
The name of the rule</p>
<p><strong>-FromScope:</strong><br />
Sets the scope to mails from external. This means mails from sender domains that are not in AcceptedDomains of the Exchange organization or are defined as an External Relay Domain.</p>
<p><strong>-RecipientDomainIs:</strong><br />
The recipient domain you want to mark external mails for.</p>
<p><strong>-SenderAddressLocation:</strong><br />
Set to <span style="color: #993333;">Envelope</span> to advise Exchange to fetch the sender&#8217;s address from the mail-header and not from the from field. Since the from field contains the visual address it can be prone to spoofing attempts. To make sure the real sender&#8217;s is address used in the rule use Envelope.</p>
<p><strong>-PrependSubject:</strong><br />
Specify some patterns or words which will be prepended to the subject to tag external mails.</p>
<p><strong>-Enabled:</strong><br />
Activates the rule. If you just want to set up the rule without activating it set the value to <span style="color: #993333;">$False</span></p>
</div>
<p><span style="font-weight: bold; font-size: 18px;">For a multi-tenant Exchange environment</span><br />
Create a new Rule with the parameters below:</p>
<div class="wpe-box wpe-box-white"><strong>New-TransportRule -Name</strong> <span style="color: #993333;">&#8220;Mark mails from external&#8221;</span> <strong>-FromAddressMatchesPatterns</strong> <span style="color: #993333;">&#8220;@&#8221;</span> <strong>-RecipientDomainIs</strong> <span style="color: #993333;">testlab.local</span> <strong>-ExceptIfSenderDomainIs</strong> <span style="color: #993333;">testlab.local</span> <strong>-PrependSubject</strong> <span style="color: #993333;">&#8220;[EXT]&#8221;</span> <strong>-SenderAddressLocation</strong> <span style="color: #993333;">Envelope</span> <strong>-Enabled</strong> <span style="color: #993333;">$True</span></div>
<h3>A Short explanation of the used parameters:</h3>
<div class="wpe-box wpe-box-note3" style="text-align: justify;"><strong>-Name:</strong><br />
The name of the rule.</p>
<p><strong>-FromAddressMatchesPattern:</strong><br />
To catch all mails we give it a common pattern that can be found in all SMTP addresses.</p>
<p><strong>-RecipientDomainIs:</strong><br />
The recipient domain you want to mark external mails for.</p>
<p><strong>-ExcepIfSenderDomainIs:</strong><br />
An exception for your own domain makes sure that your internal mails ( means within the domain you specify here. Not within the Exchange organization! ) will not be marked.</p>
<p><strong>-PrependSubject:</strong><br />
Specify some patterns or words which will be prepended to the subject to tag external mails.</p>
<p><strong>-SenderAddressLocation:</strong><br />
Set to <span style="color: #993333;">Envelope</span> to advise Exchange to fetch the sender&#8217;s address from the mail-header and not from the from field. Since the from field contains the visual address it can be prone to spoofing attempts. To make sure the real sender&#8217;s address is used in the rule use Envelope.</p>
<p><strong>-Enabled:</strong><br />
Activates the rule. If you just want to set up the rule without activating it set the value to <span style="color: #993333;">$False</span></p>
</div>
<h3><img class="alignnone size-full wp-image-2050" role="img" src="https://webbanshee.net/wp-content/uploads/2019/01/round_3.svg" alt="3 -" /> Summary:</h3>
<div class="wpe-box wpe-box-download" style="background: #e7f7d3;">The 1st Mail Flow Rule, which can be used in a single-tenant environment, is triggered when Exchange detects the senders&#8217; domain as a domain that is outside of the Exchange organization.<br />
This means that the senders&#8217; domain is not listed in Accepted Domains or is not configured as an External Relay Domain on the Exchange server.</p>
<p style="text-align: justify;">The 2nd rule, which can be used in a multi-tenant environment ( and also in single-tenant environments ), considers mails from all senders as external emails since the parameter -FromAddressMatchesPattern is filled with the value &#8220;@&#8221; which matches every SMTP address in the envelope.</p>
<p style="text-align: justify;">This is another fact that underlines the importance to set -SenderAddressLocation to Envelope. We have seen visual sender addresses in the FROM field where just a name without @ was displayed. ( only in mails where a malicious sender pretends to be someone out of the recipients&#8217; organization. Spoofing. )</p>
<h3>And here the results:</h3>
<p><a href="https://webbanshee.net/wp-content/uploads/2020/01/ExtMail.png"><img loading="lazy" class="aligncenter size-full wp-image-3208" src="https://webbanshee.net/wp-content/uploads/2020/01/ExtMail.png" alt="Mail Flow Rule External" width="1039" height="273" srcset="https://webbanshee.net/wp-content/uploads/2020/01/ExtMail.png 1039w, https://webbanshee.net/wp-content/uploads/2020/01/ExtMail-300x79.png 300w, https://webbanshee.net/wp-content/uploads/2020/01/ExtMail-768x202.png 768w, https://webbanshee.net/wp-content/uploads/2020/01/ExtMail-1024x269.png 1024w" sizes="(max-width: 1039px) 100vw, 1039px" /></a></p>
<p>With the parameter -ExceptIfSenderDomainIs filled with your recipient domain emails from your domain to your domain ( internal mails ) will not be tagged as external mails.<br />
<a href="https://webbanshee.net/wp-content/uploads/2020/01/IntMail.png"><img loading="lazy" class="aligncenter size-full wp-image-3209" src="https://webbanshee.net/wp-content/uploads/2020/01/IntMail.png" alt="Mail Flow Rule Mark External Mail" width="1042" height="270" srcset="https://webbanshee.net/wp-content/uploads/2020/01/IntMail.png 1042w, https://webbanshee.net/wp-content/uploads/2020/01/IntMail-300x78.png 300w, https://webbanshee.net/wp-content/uploads/2020/01/IntMail-768x199.png 768w, https://webbanshee.net/wp-content/uploads/2020/01/IntMail-1024x265.png 1024w" sizes="(max-width: 1042px) 100vw, 1042px" /></a></p>
</div>
<p>Find a description on the conditions here:  <span style="color: #993333;"><a style="color: #993333;" href="https://docs.microsoft.com/en-us/exchange/policy-and-compliance/mail-flow-rules/conditions-and-exceptions?view=exchserver-2019" target="_blank" rel="noopener noreferrer">Mail flow rule conditions</a></span></p>
<p>Have a nice day!<br />
&nbsp;<br />
</p>
<p>The post <a rel="nofollow" href="https://webbanshee.net/mail-flow-rule-mark-external-mail/">Mail Flow Rule Mark External Mail</a> appeared first on <a rel="nofollow" href="https://webbanshee.net">Webbanshee</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://webbanshee.net/mail-flow-rule-mark-external-mail/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3145</post-id>	</item>
	</channel>
</rss>
