mail_from_check.sh

mail_from_check.sh

Checks if the smtp “mail from:” command matches the “From:” mail header. Deliver if does, discards if not. 💡

CHANGELOG:
2.6: Check for recipient email on subject.
2.5: Check for valid domain on alternate sender email address.
2.4: Checks for empty subject lines.
2.3: Check if sender TLD matches last smtp server TLD.
2.2: Added option to attach the offending email on the warning email.
2.1: Added option to deliver quarantined emails when you run the script outside postfix, Fixed cleaning temporary files.
2.0: Made possible chain to another content filter from outside Postfix.
1.9: Added email warning if a mail fails validation, Made sure expect will work, Updated eof RFC header_checks.
1.8: Added RFC2822 compliance, Added subdomain check.
1.7: Added size check, Made possible to chain with another content_filter.
1.6: Changed status messages.
1.5: Changed whitelist to RegEx.
1.4: Code optimized. Final version I believe!
1.3: Changed to check only the 1st From: header.
1.2: Optimized code, Added quarantine option.
1.1: Added domain check, Added whitelist, Multiple From: headers check.
1.0: Checks if From: header and Return-Path matches.

7 ideias sobre “mail_from_check.sh

  1. Pingback: How to configure postfix to reject mails having invalid return path

  2. the script contain some errors:
    a) line 264
    the condition if [ -z “$validate” ]; then
    will be never match -> not check sender domain and smtp domain

    b) line 353
    missing space between ” and ]
    if [ -z “$error”]; then error=”0″; fi;
    if [ -z “$error” ]; then error=”0″; fi; – corect

    cheers!

    • Hello portos!

      Thank you for the remarks, fixed the space typo on the b) quote!
      Regarding the a) quote, that condition verifies if the email is whitelisted (validated) or if it was refused by previous checks (not validated) before doing that check block, optimizing the script running time 🙂

      Cheers!!

  3. Pingback: 22soccers

Escreva seu comentário: