writer.writeMessage(transformed, System.out);
// Messages should be disposed of when they are no longer needed.
// Disposing of a message also disposes of all child elements (e.g. body
// parts) of the message.
transformed.dispose();
// Print original message to illustrate that it was not affected by the
// transformation.
System.out.println("\n\nOriginal template:\n------------------\n");
writer.writeMessage(template, System.out);