none
Rejecting message based on email header ( in Office365 ) RRS feed

  • Question

  • I have a very simple 'mail flow' rule which states that exchange should reject a message when it sees an email that has a header set to a specific value. The rule is in active/enforced mode but I can't get it to work.

    My guess is that exchange is unable to find or match the header (Although the test email I am sending has header set to correct value).


    I have tried that same (rejection) rule for the 'subject' field and it worked as expected. I am using custom/non-standard header named "Action" but its a valid mail/mime header.

    To avoid rule priority issues , I have made sure that there is only one rule defined, it did not help.


    Thanks .

    Thursday, October 25, 2018 10:50 AM

All replies

  • Hi,

    We suggest you post the rule details here, including the conditions, actions and exceptions.

    If you are using the condition "A message header > includes any of these words", change it to "A message header > matches these text patterns", and vice versa.

    Let me know the result.

    Regards,

    Manu Meng


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Friday, October 26, 2018 8:11 AM
    Moderator
  • Hi Manu, 

    Below are the rule details, I have tried both 'includes any of these words' as well as 'matches these text patterns' conditions. In addition to that I have also verified that email client is setting the header (Custom-Action) properly. 

    Name               : Reject If header matches
    State              : Enabled
    Description        : If the message:
                          'Custom-Action' header matches the following patterns: 'block'
                         Take the following actions:
                          reject the message and include the explanation 'Message rejected due to header match.' with the status code: '5.7.1'
                          and Stop processing more rules
    StopRuleProcessing : True
    ActivationDate     : 
    ExpiryDate         : 
    Priority           : 0

    Thanks,
    W.Azhar

    Friday, October 26, 2018 6:02 PM
  • Hi Manu, 

    Below are the rule details, I have tried both 'includes any of these words' as well as 'matches these text patterns' conditions. In addition to that I have also verified that email client is setting the header (Custom-Action) properly. 

    Name               : Reject If header matches
    State              : Enabled
    Description        : If the message:
                          'Custom-Action' header matches the following patterns: 'block'
                         Take the following actions:
                          reject the message and include the explanation 'Message rejected due to header match.' with the status code: '5.7.1'
                          and Stop processing more rules
    StopRuleProcessing : True
    ActivationDate     : 
    ExpiryDate         : 
    Priority           : 0

    Thanks,
    W.Azhar

    What is the Custom-Action header? Could you share more details about this?

    Regards,

    Manu Meng


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Wednesday, October 31, 2018 8:27 AM
    Moderator