On Tue, Jan 19, 2010 at 03:53:51PM +0100, Johan Lundberg wrote:
The code works as I expect when the pattern is found in the subject of
the mail but when the script tries to look in the body Mimedefang
crashes and I have to reread the filter file to be able get it working
again.

What errors do you see in your mail log when it dies? My immediate thought is that this code here is to blame:

           my $body = $entity->bodyhandle;
           my $IO = $body->open("r");
           while (defined($_ = $IO->getline)) {

Not all MIME::Entity objects will have bodies! For example, a multipart/mixed or multipart/alternative toplevel won't, leaving ->bodyhandle to return undef into $body and causing $body->open() to die.

There are two better ways to do what you're trying to do.

1) Do your body checking in filter(), as it only gets called on entities with a body.

2) Open up $CWD/INPUTMSG and check the raw message directly.

Cheers,
Dave
--
Dave O'Neill <[email protected]>    Roaring Penguin Software Inc.
+1 (613) 231-6599                        http://www.roaringpenguin.com/
For CanIt technical support, please mail: [email protected]
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to