NONE TITLE 2.html
Keywords: NONE TITLE,fml, flexible mailing list manager, not listserv style but fmlserv emulates listserv or majordomo style

[PREVIOUS CHAPTER] [NEXT CHAPTER]

2 examples

reject null Message-Id: reject null Message-Id: &DEFINE_FIELD_PAT_TO_REJECT('message-id', '^\s*$'); 2.2 reject Subject: with FREE, SEX, ADULT, XXX.

    	reject Subject: with FREE, SEX, ADULT, XXX.
    	(but this config ignores "free software" content ?;-).

    	&DEFINE_FIELD_PAT_TO_REJECT('subject', 'FREE|SEX|ADULT|XXX');
    	&DEFINE_FIELD_PAT_TO_REJECT('subject', '/FREE|SEX|ADULT|XXX/');
    	&DEFINE_FIELD_PAT_TO_REJECT('from', 'ADULT');

    2.3	reject Subject: with FREE, SEX, ADULT, XXX (case insensitive).

    	reject Subject: with FREE, SEX, ADULT, XXX (case insensitive).

    	&DEFINE_FIELD_PAT_TO_REJECT('subject', '/free|sex|adult|xxx/i');

    2.4	reject if received: contains spam.co.jp

    $DISTRIBUTE_FILTER_HOOK = q#
        if ($e{'h:received:'} =~ /from spam.co.jp/) {
    	return 'from a host in spam blacklist';
        }
    #;

    2.5	reject if the mail body contains http-equiv=3DContent-Type

    $DISTRIBUTE_FILTER_HOOK = q#
        if ($e{'Body'} =~ /http-equiv=3DContent-Type/) {
    	return 'mail with appended HTML documents';
        }
    #;

    2.6	reject if the domain of From: conflicts Message-ID:

    $DISTRIBUTE_FILTER_HOOK = q#
       local($domain) = (split(/@/, $From_address))[1];
       if ($e{'h:message-id:'} !~ /$domain/i) {
    	return 'Message-Id conflicts your From: address';
       }
    #;

    2.7	aggregate the previous 3 rules

    Example:
    	* reject if a Received: line has "from spam.co.jp".
    	* reject if http-equiv=3DContent-Type exists in the body.
    	* reject $From_address conflicts with Message-Id:'s domain.

    $DISTRIBUTE_FILTER_HOOK = q#
        if ($e{'h:received:'} =~ /from spam.co.jp/) {
    	return 'from a host in spam blacklist';
        }

        if ($e{'Body'} =~ /http-equiv=3DContent-Type/) {
    	return 'mail with appended HTML documents';
        }

       local($domain) = (split(/@/, $From_address))[1];
       if ($e{'h:message-id:'} !~ /$domain/i) {
    	return 'Message-Id conflicts your From: address';
       }

    #;

    2.8	rule combined with sendmail PICKY_HELO_CHECK

    Example 2: When you configure PICKY_HELO_CHECK is on in config.h of
    sendmail, reject mail when it has X-Authentication-Warning by
    PICKY_HELO_CHECK. However this filter does not work well
    since virtual domain users matches them even if they are not spammers;D

        # PICKY_HELO_CHECK
        if ($e{'h:x-authentication-warning:'} !~ /Host \S+ claimed to be \S+/) {
    	$r = "Your SMTP session or your host config is invalid";
        }

    2.9	size limit for the mail header

    fml checks the size of the whole mail not distinct each header and
    body.

    2.10	To: or Cc: should have $MAIL_LIST !

    fml-support: 06389
    fml-support: 07286

    If To: or Cc: have not $MAIL_LIST, it is a spam !

    $USE_DISTRIBUTE_FILTER = 1;
    $DISTRIBUTE_FILTER_HOOK = q#
        if (($e{'h:to:'} !~ /$MAIL_LIST/i) && ($e{'h:cc:'} !~ /$MAIL_LIST/i)){
            return 'Not addressed to mailing list';
        }
    #;

    2.11	hook without using EnvelopeFilter

    # check attatchment of VB script and others :-)
    $START_HOOK .= q#
        if ($Envelope{'Body'} =~ /Content.*\.(vbs|js|jse|exe)/i ||
    	my($savefile) = "$FP_TMP_DIR/badarticle.$PCurrentTime";
    	if (open(SAVE, "> $savefile")) {
    	    print SAVE $Envelope{'Header'};
    	    print SAVE "\n";
    	    print SAVE $Envelope{'Body'};
    	    close(SAVE);
    	    $Envelope{'Body'}  = 'WARNING: incoming mail is ignored ';
    	    $Envelope{'Body'} .= 'since it may be with virus.';
    	    $Envelope{'Body'} .= "\n\n";
    	    $Envelope{'Body'} .= "This article is saved in\n";
    	    $Envelope{'Body'} .= $savefile;
    	    $Envelope{'Body'} .= "\n\n";
    	    $Envelope{'Body'} .= "-- $MAIL_LIST maintainer\n";
    	}
    	else {
    	    &Log("system error: pass this article through");
    	}
        }
    #;

    2.12	Duplicated Message-ID for mails from Notes

    It is impossible to solve this. Fix your MTA.

    2.13	Reject Mails From Specific Domains

    Before the main routine works, fml.pl can check and reject mails from
    specific domains in $REJECT_ADDR_LIST ($DIR/spamlist in default).
    Please write e.g.

       \S+@spam.org (reject spammers?, mails from spam.org)
       manager@\S+  (reject not personal addresses)

    fml adjusts $REJECT_ADDR for rejection irrespective of this file.

    2.14	ISP enforce to append a signature to your mail

    Such an ISP is terrible since it implies YOU HAVE NO SECRET, someone
    can rewrite your mail.

    To cut off the last signature.

    $SMTP_OPEN_HOOK = q#
    	local($uja);
    	for (split(/\n/, $e{'Body'})) {
    	   next if /=+/ .. /\-+/;
    	   $uja .= "$_\n";
    	}

    	$e{'Body'} = $uja;
    #;

[PREVIOUS CHAPTER] [NEXT CHAPTER]