none
Transport rule to validate recipient email address RRS feed

  • Question

  • Is it possible to create a transport rule (on a non-edgesyncd Edge server) to reject an email if the recipient's email address is in an incorrect format? Specifically, if the domain has no '.' in it, eg test@server

    Can this be done using a regex pattern in a rule?

    Thanks

    Friday, January 18, 2013 3:57 PM

Answers

  • Hello,

    There seems not related conditions in transport rule to realize it.


    Cara Chen
    TechNet Community Support


    • Edited by cara chen Friday, January 25, 2013 8:40 AM
    • Proposed as answer by cara chen Friday, January 25, 2013 8:40 AM
    • Marked as answer by cara chen Sunday, January 27, 2013 7:55 AM
    Monday, January 21, 2013 8:26 AM

All replies

  • Use the condition "When recipients's address matches text patterns"

    http://technet.microsoft.com/en-us/library/aa997187(v=exchg.141).aspx#creating

    The caret ( ^ ) character indicates that the pattern string that follows the caret must exist at the start of the text string being matched.

    For example, ^fred@contoso matches fred@contoso.com and fred@contoso.co.uk but not alfred@contoso.com.

    Friday, January 18, 2013 4:28 PM
  • Thanks, yes I have read that - it's the actual Regex I am struggling with. I need to somehow check there is a '.' after the '@' but I can't figure out how to do it.
    Friday, January 18, 2013 4:30 PM
  • "^[a-z0-9]+(\.[a-z0-9]+)*@"

    [a-z0-9] = must start with a-z or 0-9

    \. must contain . 

    Friday, January 18, 2013 4:45 PM
  • Thanks, but Exchange doesn't like that. When I try to add it to the "when any recipient address matches text pattern" rule, it fails saying there is a problem with the backslash.

    Thinking about it, what I actually need is a regex for addresses that do NOT contain a '.' after the '@' since I want the rule to say

    when any recipient address matches text pattern <regex>, reject the message with status xxx

    Friday, January 18, 2013 4:55 PM
  • If you want to reject any message sthat do have . in the domain name then use. This will reject any messages without @contoso.com. If you have more than one domains then use a or to add multiple strings like below for each domain name.

    ^*@contoso.com 

    Friday, January 18, 2013 5:40 PM
  • Is it possible to create a transport rule (on a non-edgesyncd Edge server) to reject an email if the recipient's email address is in an incorrect format? Specifically, if the domain has no '.' in it, eg test@server

    Can this be done using a regex pattern in a rule?

    Thanks

    So ,just curious, why the need to do this? Is there something not working correctly?
    Friday, January 18, 2013 5:58 PM
    Moderator
  • We are using this server (and a few others) as a simple relay through which several thousand application servers send email. Access is restricted by IP address, but the Receive Connectors have "allow any recipient" permissions. Our servers then either relay the mail into our corporate mail system, or out of our company.

    As we have no control over the various servers relaying through these Edge servers, many can be misconfigured (mainly Unix Sendmail) and send a lot of stuff to these invalid domains, eg root@server. At the moment, we accept the mail and then I have a Powershell script run every 15 mins to look for this invalid mail and delete it. I was just wondering if I could somehow use a Transport Rule to block it being accepted in the first place.

    Friday, January 18, 2013 7:46 PM
  • Is this anonymous receive connector? If use you can modify the permissions to send and receive email only the accepted domains.
    Friday, January 18, 2013 7:59 PM
  • Hello,

    There seems not related conditions in transport rule to realize it.


    Cara Chen
    TechNet Community Support


    • Edited by cara chen Friday, January 25, 2013 8:40 AM
    • Proposed as answer by cara chen Friday, January 25, 2013 8:40 AM
    • Marked as answer by cara chen Sunday, January 27, 2013 7:55 AM
    Monday, January 21, 2013 8:26 AM