Dropping a email using Pre-Proc Script

Any Headers you wish to alter must be in the Matching Headers csv, or they will not be processed!

You may have a email sender that you do not want to create any new issues or comments. With this solution it does not use jemhUtils.dropMessage as this can not be used with the Pre-Proc tasks. This solution will alter the subject to a value that matches the global blacklist.

Example Email

MIME-Version: 1.0 Received: by 10.223.112.12 with HTTP; Sat, 18 Jun 2011 22:42:26 -0700 (PDT) Date: Sun, 19 Jun 2011 17:42:26 +1200 Message-ID: <BANLkTinB1mfSh+GwOXGNWoL4SyDvOpdBoQ@mail.gmail.com> Subject: this message should be dropped when it is processed From: system@x.com To: mailbox@localhost Content-Type: text/plain; charset=UTF-8 will the comment be rejected since the field processor has been changed testbody

Example Script

/* Enter custom Script here (example below) -- USE LOWER CASE HEADER NAMES */ /*Retrieves the sender of the email*/ var sender = headerBeans.get('from').getOriginalVal(); print('sender: '+ sender); /*Retrieves the subject from email*/ var subjectVal = headerBeans.get('subject').getOriginalVal(); print('subject: '+ subjectVal); /*checks if sender is system@x.com*/ if(sender == "system@x.com"){ /*Alters the subject to Drop Me*/ headerBeans.get('subject').setUpdatedVal("Drop Me"); print('New subject: ' + headerBeans.get('subject').getUpdatedVal() ); }