Set up to block email by name

Discussion in 'Mail Gateway: Installation and configuration' started by Robson Rissato, Oct 23, 2018.

  1. Robson Rissato

    Robson Rissato New Member

    Joined:
    Aug 15, 2018
    Messages:
    13
    Likes Received:
    0
  2. Robson Rissato

    Robson Rissato New Member

    Joined:
    Aug 15, 2018
    Messages:
    13
    Likes Received:
    0
  3. heutger

    heutger Active Member

    Joined:
    Apr 25, 2018
    Messages:
    281
    Likes Received:
    69
    You should be able to set a RegEx in the rule system or create your own postfix header check. I currently use

    /etc/postfix/header_checks
    Code:
    /^From:/ INFO
    /^To:/ INFO
    /^Subject:.*medtrade.*/ REJECT
    /^Subject:.*user.*list.*/ REJECT
    /^Subject:/ INFO
     
  4. Robson Rissato

    Robson Rissato New Member

    Joined:
    Aug 15, 2018
    Messages:
    13
    Likes Received:
    0
    I did not quite understand how to do this, could you give me example using data above .... in my example ... please .... tks
     
  5. heutger

    heutger Active Member

    Joined:
    Apr 25, 2018
    Messages:
    281
    Likes Received:
    69
    I‘m unsure on how to do with RegEx. How to do with postfix checks I could provide, but it would require adjustments via SSH, are you able to do so?
     
  6. Robson Rissato

    Robson Rissato New Member

    Joined:
    Aug 15, 2018
    Messages:
    13
    Likes Received:
    0
  7. heutger

    heutger Active Member

    Joined:
    Apr 25, 2018
    Messages:
    281
    Likes Received:
    69
    Ok, when you would need to follow the manual on how to copy the PMG template files and adjust the main.cf.in to include postfix header checks file.

    In this file you need to do something like

    /^From:.*zattini.*/ REJECT
    /^From:.*netshoes.*/ REJECT

    Hopefully, this is given in the header from. Otherwise you would need to check the body content.

    After creating and including you would need to sync the templates as written in the docu.
     
  8. guletz

    guletz Active Member

    Joined:
    Apr 19, 2017
    Messages:
    640
    Likes Received:
    95
    Hi,

    Never replay with a simple reject on unwanted mails. Use Discard. Even better use reject with a standard message like : xxx user unknown
     
  9. heutger

    heutger Active Member

    Joined:
    Apr 25, 2018
    Messages:
    281
    Likes Received:
    69
    Discard is forbidden in Germany as that suppress a mail and although being 99,9% sure, that it’s spam to be rejected, there is still a chance left to reject non-spam. Same for the message. I currently run good with this and had no trouble, but you’re free to do it different.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice