July 7 2016

Sending email notifications in Oracle BPEL or BPM projects can turn into a major effort if you are not using ADF–and sometimes even if you are using ADF. If you use ADF, you can leverage features such as HTML editors and actionable emails. But in many situations you may need a stand-alone email formatting solution that doesn't involve ADF, that can produce a simple HTML-based email, and that doesn't need to be actionable. You will find that that simple SOA-based approach helps you implement your requirements efficiently and effectively.

This approach

  • Integrates with BPM and BPEL
  • Is HTML-based and can contain dynamic information from a database
  • Leverages BPEL and BPM direct assignments and role-based assignments
  • Includes a template selector, for sending different types of emails
  • Handles attachments
  • Intercepts and redirects emails for testing purposes

A detailed description of this email notification system is described below. Upon request we would be happy to provide the actual project code describe here. 

Input XML 

This is a sample of the input XML. Notice the data includes

  • A record ID – Used to pull data from the database for embedding information in the email
  • An array of "TO" email addresses – Use to lookup email addresses from user names or BPM application roles.

Input XML

The Email Notification Composite

The email notification service contains a composite, as shown. This composite contains

  • Send Email (BPEL) Pre-Processor – For getting email content and addressing information, prior to formatting
  • Email Type Mediator – To select a style-sheet for formatting the email
  • Email Service Wrapper (BPEL) – To post-process the formatted emails, as required for testing and trouble-shooting

The Email Notification Composite also contains a Get Related Email Content DB adapter and the notification service. The DB adapter is used to pull information needed for the email into an XML documents, whereas the NotificationService is the SOA suite email notification service interface. It is configured through Enterprise Manager as described in Oracle FMW Administrators Guide.


Send Email Composite

Send Email Pre-Processor

The Send Email Pre-processor pulls information from the database and translates user names and BPM application roles into email addresses. The database adapter will get application data into XML that can be extracted into an email using XSLT. Email addresses are pulled from the security provider managed by Weblogic. The user security data and email addresses can be stored in any LDAP or Active Directory security provider service. 


Send Email BPEL

Getting email addresses for user assignments and BPM application roles requires two nested for-loops, shown in the detailed view of Send Email BPEL process. The first one loops through user names or roles provided in the input XML,and the other loops through users in the application roles. The two key statements required are getUsersInAppRole and getUserProperty. getUsersInAppRole returns an array of users in the app role, whereas the getUsersProperty gets the email address for a given user name. The full statement is listed below. Notice that the user names contained in the application roles are iterated using the index variable $nextUserInRole whereas the list of address in the input XML is iterated using $toAddressIdx. 

$nextUid = ids:getUsersInAppRole(InputVariable.request/ns2:emailHeaderData/ns2:toList/ns2:sendTo[$toAddressIdx]/ns2:userId,'OracleBPMProcessRolesApp',false())[$nextUserInRole]



Email Addressing Logic

Formatting the Email

Many different types of emails can be formatted using a mediator. The mediator uses a filter to determine which XSLT is used to format the email. The selection is based on the emailType or, in this example, "HELLO_WORLD_EMAIL".

Email Mediator


The XSLT used for emailType = "HELLO_WORLD_EMAIL" is Format_HelloWorldEmail.xsl. This XSLT will embed data from the database and format the email as show in this example. After the XSLT formats the email, the formatted content goes into the email service wrapper described next. 


Email XSLT Example


Email Service Wrapper 

The email service wrapper is a BPEL process that optionally re-directs the email to tester email addresses and interfaces with the SOA suite email service.

To transfer the HTML-based email into the SOA-Suite email service, you need to get the HTML element attributed from the formatting provided and embed it as a string. This is the code that performs that operation:



Email Service Wrapper


This is the crux of the code needed to implement your own HTML-based email service for your BPEL and BPM projects. If you have any questions, please let us know. We can provide you with a completed example. Just fill out the pop-up form so we can get back to you.  


About the Author

Mark Peterson

Software Implementer using Business Process Management (BPM) for small to large firms. Used best practices in system design and software methodologies. Successfully executed projects on time and on budget using incremental and iterative software development methodologies.

Join the Conversation

July 27, 2016

Is it really necessarily to create all of those BPM projects? I would say that just formatting email and make my essay would already do a lot.

Ramiro Ortiz Rios
September 28, 2016


Could you share with me the complete source code? Thanks.

March 8, 2017


Please share with me the complete source code for this example? Thanks a lot.

March 20, 2017

could you please share complete code for this example? 

April 16, 2017

Hi Mark,

Can you share complete code for this project. I am trying to implement something similar in my current project.




Henrio Respati
August 10, 2017

Hi Mark,

Thank you for this post. Would you mind sharing the source code since I am currently doing a similar one to this?

Best Regards,


Enter your first name. It will only be used to display with your comment.
Enter your email. This will be used to validate you as a real user but will NOT be displayed with the comment.