Sending an email with attachment from Oracle BPEL
In my previous post I described how to create a PDF file/report in Oracle BPEL (Create a JasperReport from Oracle BPEL).
Now I will describe how to sent this PDF file as attachment in an email.
After invoking the createBookService the outcome is used to construct the email message. In particular the filename and the Base64 encoded report.
Constructing the email
Open de mailBook2Maggie mail task by double clicking on it. The General tab of the email task definition is show.
For this example I used a fixed values for the to, subject and body fields. The from account is left on Default.
The attachment tab show a grid where the attachments can be defined.
Click the green PLUS sign to add an attachment definition.
The default attachment name is â€˜attachment1â€™ and the default mime type isâ€™ text/html;â€™.
This screen actually has a bit strange behavior. The created report is not of the â€˜text/html;â€™ type.
Changing this value via this user interface could result in a very annoying exercise.
I have chosen to leave the defaults here and change the values in a different way. Close the email task definition screen by clicking OK.
Open the mail task by selecting the PLUS sign.
The mail task consist of the assignment of the email setting and the invocation of the email service.
The assignment activity can also be used to change the mailservice payload. Lets start doing this. Double click on it to open.
As shown in the screenshot, the email has a multipart content body.
This first part contains the email body and an indication of the body mime type.
The second part contains the report in the body, the mime type of the report and the name of the report.
This post ends with an example of how a received email looks in Maggies email box.
- SOA and Email in action – Starting a BPEL process instance by sending an email with XML content- on decoupled interaction between web-site and back office
- Oracle BPEL PM 10.1.3 – Sending an Email to multiple recipients
- Configure SOA Suite 11g for sending email notifications with Google Mail
- Invoking HTTP Services from Oracle BPEL PM – SOA enabling PHP, Servlets, RSS,…
- Oracle BPEL PM – Invoking a (remote) BPEL Service from Java using RMI