JS PreProc Task : Conditionally remove Precedence header

Objective

Stop Precedence: bulk header from triggering rejection for specific sender.

Approach

Its not yet possible to do this in configuration, a scripted PreProc Task is possible to vary the value, removal of the header entirely is https://thepluginpeople.atlassian.net/browse/JEMHC-3329 . Ability to see ‘print’ output at edit time ishttps://thepluginpeople.atlassian.net/browse/JEMHC-3328 .

 

Example Mail

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 Subject: Testing From: "Mr Andy" <andy@localhost.com> To: support@localhost.com Precedence: bulk Content-Type: text/plain; charset=UTF-8 CHANGE BODY!!!

Script

if (message.getHeader('from')!=null && message.getHeader('Precedence')!=null && message.getHeader('from').toLowerCase().indexOf('andy@localhost.com')!=-1) { message.setHeader('Precedence','ignore'); }

Test Script

assert.equal(message.getHeader('Precedence'), 'ignore');

Outcome:

Test Case passed