WSO2 G-Reg Modify Subject of the Email Notification

WSO2 Governance Registry generates notifications for events triggered by various operations performed on resources and collections stored in the repository. Notifications can be consumed in a variety of formats including E-mail. The sample "E-mail NotificationCustomization" shows how we can modify the content of emails. It describes how to edit email body and restrict email notification to some email addresses.

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.

Comments

Popular posts from this blog

XSLT - Modify Date and DateTime value

Integrate With Mutual Certificate Authentication based Service

Yield Price Sri Lanka - Android Application