Here I am going to extend that sample to modify Subject of the email.
private void editSubject(MessageContext msgContext, String newSubject) {
((Map)
msgContext.getOptions().getProperty( MessageContext.TRANSPORT_HEADERS)).put(MailConstants.MAIL_HEADER_SUBJECT, newSubject);
}
You will have to import "org.apache.axis2.transport.mail.MailConstants;" class and other related Java util classes as well.
When you are building the sample code, please follow the instructions available in the Governance Registry Sample Documentation.