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.

Sending an email with attachment from Oracle BPEL BPEL flow

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

After invoking the createBookService the outcome is used to construct the email message. In particular the filename and the Base64 encoded report.

Sending an email with attachment from Oracle BPEL assign service output

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.

Sending an email with attachment from Oracle BPEL email general tab

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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.

Sending an email with attachment from Oracle BPEL email attachments tab

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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.

Sending an email with attachment from Oracle BPEL Email opengeklapt

 

 

 

 

 

 

 

 

 

 

 

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.

 

Sending an email with attachment from Oracle BPEL email assignments

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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.

Sending an email with attachment from Oracle BPEL thunderbird

4 Comments

  1. kishore July 22, 2015
  2. Marcel van de Glind October 12, 2013
  3. Nagarur October 11, 2013
  4. KandikuntaSrilaxmi February 23, 2012