[Mimedefang] Removing redundant html part and header for one user incoming.

David F. Skoll dfs at roaringpenguin.com
Wed Mar 20 11:04:54 EDT 2013


On Wed, 20 Mar 2013 15:52:02 +0100
Lars Sorensen <lars at daxzuli.com> wrote:

=====================================================
sub filter_begin {
    open (IN, "<./COMMANDS");
    while(<IN>) {
        if(/R<email\@mydomain\.com>/i) {
            action_delete_all_headers("X-Header-to-delete");
            last;
        }
    }
    close(IN);
}
=====================================================

Wow, that's going about it the hard way!  You should NEVER have to read
./COMMANDS yourself.  That can be replaced with one line:

action_delete_all_headers('X-Header-to-delete') if grep { /<email\@mydomain\.com>/i } @Recipients;

> Same thing for the "remove_redundant_html_parts($entity);"
> The problem I was having, was looking for the recipient in the
> HEADERS as opposed to the COMMANDS file, thereby missing when when
> Bcc's and list email recipients was specified.

Use the @Recipients array to get the envelope recipients.

Regards,

David.



More information about the MIMEDefang mailing list