Skip to main content

Accept mail from certain TLD's only block everything else

Comments

6 comments

  • keat63
    Pretty easy from a domain side using Global Filters. Login in to the domain Cpanel, create a global filter based on 'from ... does not end with' or 'from .......does not contain' A little experimentation I'm sure you'll achieve what you want. On a server level, it's probably a little more complex, but as a website owner, you won't have access at server level. Global Email Filters - Version 76 Documentation - cPanel Documentation
    0
  • ampapa
    Appreciate the reply. When creating a Global/User filter on the account I understand the accept 'from' concept but that creates a problem. The mail needs to follow one of the "Actions" listed below: Email Filter Action Rules Discard Message Deletes the message with no Failure message. Redirect to Email Sends the email to another email address. Fail with Message Deletes the email and sends a failure message.. Stop processing rules Does not run any filter rules. Deliver to folder Sends the email to a specified folder. Pipe to program Sends the email to a program or script on the server. The only one that seems to apply is "Discard Message" but that would mean I would have to list each TLD "I DO NOT" want to accept mail from and that would be silly and not very useful. What makes more sense is to accept mail from those TLD's I DO WANT mail from, that list is posted earlier, and none of these actions appear to allow the mail to further be tested it has to be directed to a certain mail box, again not useful. I don't think a 'from' filter is going to work. I need to filter TLD's and continue with mail processing, how do I do that? ampapa,
    0
  • keat63
    If you create a filter "If from does not end with .com" - "Discard message", then anything coming from .biz would be discarded as it doesn't end with .com something like the attached image ??
    0
  • ampapa
    I get the following when testing the filter... it matched something and was deleted. here is the test data: To: test5@example.com From: tes5@example.com Subject: test This is a test message. The Filter has matched the following condition(s): (((((($header_from: does not end .com or $header_from: does not end .net) or $header_from: does not end .org) or $header_from: does not end .int) or $header_from: does not end .edu) or $header_from: does not end .gov) or $header_from: does not end .mil) or $header_from: does not end .us ((((($header_from: does not end .com or $header_from: does not end .net) or $header_from: does not end .org) or $header_from: does not end .int) or $header_from: does not end .edu) or $header_from: does not end .gov) or $header_from: does not end .mil (((($header_from: does not end .com or $header_from: does not end .net) or $header_from: does not end .org) or $header_from: does not end .int) or $header_from: does not end .edu) or $header_from: does not end .gov ((($header_from: does not end .com or $header_from: does not end .net) or $header_from: does not end .org) or $header_from: does not end .int) or $header_from: does not end .edu (($header_from: does not end .com or $header_from: does not end .net) or $header_from: does not end .org) or $header_from: does not end .int ($header_from: does not end .com or $header_from: does not end .net) or $header_from: does not end .org $header_from: does not end .com or $header_from: does not end .net $header_from: does not end .net
    The folowing regex appears to be working... thanks for your idea. .*@.*\.(?!(.*\.)?(com|net|org|int|edu|gov|mil|coop|us))
    0
  • keat63
    Now that it works, in the short term I would be tempted to deliver the unwanted ones to a specific folder instead of discard. At least until you are happy that you didn't miss something important. Typical that the most important email you ever needed would be dropped . o_O
    0
  • cPanelMichael
    The folowing regex appears to be working... thanks for your idea. .*@.*\.(?!(.*\.)?(com|net|org|int|edu|gov|mil|coop|us))

    Thanks for sharing the outcome! I've marked this thread as solved.
    0

Please sign in to leave a comment.