Need to match subjects in email

Walter D. Wyndroski wdwrn at FRIENDLYCITY.NET
Thu Oct 2 21:28:16 IST 2003


I see what's happening in the code. I agree, it should work. However, would you give me a hint as to the best location in MailScanner to insert this function?

Thanks in advance!

WDW
  ----- Original Message ----- 
  From: Julian Field 
  To: MAILSCANNER at JISCMAIL.AC.UK 
  Sent: Thursday, October 02, 2003 4:10 PM
  Subject: Re: Need to match subjects in email


  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 domain.com". If it doesn't match then it returns "deliver".

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

    return "deliver" unless $message;

    if ($message->{to}[0] eq 'targetaddress at you.com' && $message->{subject} =~ /your special subject/i) {
      return 'deliver forward yourpager at domain.com';
    } 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
  www.MailScanner.info
  Professional Support Services at www.MailScanner.biz
  MailScanner thanks transtec Computers for their support
  PGP footprint: EE81 D763 3DB0 0BFD E1DC  7222 11F6 5947 1415 B654 

         This message has been scanned by CityNET's email scanner for viruses and dangerous content 
         and is believed to be clean. CityNET is proud to use MailScanner. For more information 
         concerning MailScanner, visit http://www.mailscanner.info
       

**********************************************************************************************
* This message has been scanned by CityNET's email scanner for viruses and dangerous content *
* and is believed to be clean.  CityNET is proud to use MailScanner.  For more information   *
* concerning MailScanner, visit http://www.mailscanner.info                                  *
**********************************************************************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mailscanner.info/pipermail/mailscanner/attachments/20031002/5ae80093/attachment.html


More information about the MailScanner mailing list