Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To test this feature out, create a new Test Case, using the following Test Case Content:

Image Modified

 

 

Code Block
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 is a starting email template, update as required
From: from@from.com
To: oldTo@oldTo.com, changeme@thiswontwork.com
cc: removeme@cc.com
Content-Type: text/plain; charset=UTF-8

some text 

...

Code Block
/*Edit Headers*/ 
if(headerBeans.get('to') != null){
  var toAddress = jemhUtils.getOriginalAddressees(headerBeans.get('to')); 
  print('To Address Header values:', toAddress); 
  var firstRecipient = toAddress.get(0);
  /*Set Address and Personal values of selected recipient*/
  firstRecipient.setPersonal("changed recipient");
  firstRecipient.setAddress("changed@changed.com");

  var updatedHeader = jemhUtils.updatePreProcHeader(toAddress, headerBeans.get('to')); 
  print(updatedHeader.getUpdatedVal()); 
  print(updatedHeader.getUpdatedVal()); 
  
  /*Replace Header with new value here*/ 
  headerBeans.replace("to", updatedHeader); 
}
Image Modified

 

Inserting new addresses into an existing Header

...

Code Block
/*Edit Headers*/ 
if(headerBeans.get('to') != null){
  var toAddress = jemhUtils.getOriginalAddressees(headerBeans.get('to')); 
  print('To Address Header values:', toAddress); 
  
  /*create new address*/ 
  var newAddress = jemhUtils.createInternetAddress('new', 'new@new.com'); 
  /*adding new address to To header*/
  toAddress.add(newAddress); 
  var updatedHeader = jemhUtils.updatePreProcHeader(toAddress, headerBeans.get('to')); 
  print(updatedHeader.getUpdatedVal()); 
  print(updatedHeader.getUpdatedVal()); 
  
  /*Replace Header with new value here*/ 
  headerBeans.replace("to", updatedHeader); 
}
Image Modified

 

Adding New Headers

Note

Any new Headers you wish to add must be listed the “Matching Headers” csv, or they will not be processed!

...

Code Block
/* Adding a header */ 
var bccHeader = jemhUtils.addPreProcHeader('bcc', 'newBcc@newBcc.com'); 
if(bccHeader != null){ 
  headerBeans.replace('bcc', bccHeader); 
  print(headerBeans.get('bcc')); 
} 
Image Modified

 

Use Auditing to see the post-change email content

Once the mail is changed you can download both the original mail, and the Edited mail:

image-20240312-112950.pngImage Added

API Reference

...