Need to match subjects in email

Julian Field mailscanner at
Thu Oct 2 21:10:13 IST 2003

At 18:12 02/10/2003, you wrote:
>I need to match email's by their subjects. Here is my a brief description
>of my problem:
>Municipality-->Exchange server
>Municipal ISP (owned by municipality) --> Linux mailserver
>For ease, some of the mail destined for the municipality is sent directly
>to the isp mailserver and forward via alias. I need to match a particular
>email address, then I need to further match a subject. If the subject
>meets my match criteria, I need that message forwarded to another email
>address which actually goes to a pager. We are trying to get faster
>notification of emergency messages from a particular sender. Is this
>possible? If so please post a short example.

You can do this with a Custom Function attached to "Non Spam Actions" that
checks the subject and the destination address. If it matches then it
returns "deliver forward yourpager at". If it doesn't match then it
returns "deliver".

sub PagerAction {
   my($message) = @_;

   return "deliver" unless $message;

   if ($message->{to}[0] eq 'targetaddress at' && $message->{subject}
=~ /your special subject/i) {
     return 'deliver forward yourpager at';
   } else {
     return 'deliver';

I haven't tried that, but it should work. Be warned it will only look at
the 1st recipient of the message. You will probably want to turn that into
a loop to check all the recipients of the message to see if any of them match.
Julian Field
Professional Support Services at
MailScanner thanks transtec Computers for their support
PGP footprint: EE81 D763 3DB0 0BFD E1DC  7222 11F6 5947 1415 B654
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the MailScanner mailing list