[Mimedefang] accessing mail headers in mimedefang-filter

Tilman Schmidt t.schmidt at phoenixsoftware.de
Tue Nov 25 04:02:17 EST 2008


On 22.11.2008 21:07, Jonas Eckerman wrote:
> In any callback where a MIME entity is provided to the filter, 
> you can use that to access the headers of that entity. An example:
[...]
> More info in "perldoc MIME::Head" and "perldoc MIME::Entity".

Thanks, that looks promising. So far, though, I couldn't get it
to work. I currently have:

sub filter_end ($) {
    my($entity) = @_;
    [...]
    unless ($RelayAddr =~ /^10\.0\./ || $RelayAddr =~ /^195\.227\.45\./) {
        unless (defined($entity->head) &&
                lc($entity->head->get('Precedence', 0) eq 'bulk')) {
            add_recipient('posteingang at CYRUS');
        }
    }
}

But the second "unless" clause seems to do nothing. Mails with a
"Precedence: bulk" header still get the "posteingang" recipient
added. I tried
  $entity->head->get('Precedence')
as you proposed, as well as
  $entity->head->get('Precedence', 0)
which the perldoc seems to suggest as an alternative, but it
didn't make any difference. The other check works fine, reliably
excluding mails submitted from one of those two address ranges.

How can I debug this? Is there a way to trace the execution, or
to see whether the "get" method is actually called and what it
is returning?

Thanks,
Tilman

-- 
Tilman Schmidt
Phoenix Software GmbH
Bonn, Germany

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
URL: <https://lists.mimedefang.org/pipermail/mimedefang_lists.mimedefang.org/attachments/20081125/568f1286/attachment.sig>


More information about the MIMEDefang mailing list