TIBCO Send Mail Tutorial: How to Send Email With Multiple Attachments in TIBCO BW

By | January 23, 2015

In one of my previous tutorials, I explained step by step how we can use Send Mail Activity from Mail Palette to send email from TIBCO BW process. This tutorials is an extension to that tutorial as I am going to explain in this tutorial how to send email from tibco process with multiple attachments.

Business Scenario:

Consider a scenario where some application X generates PDF files and places those PDF files in a directory. A process in TIBCO BW application checks for the files in that folder and then attaches all the PDF files and sends an email with multiple attachments.

Now let’s proceed step by step with this tutorial and see how we can send email with multiple attachments from a TIBCO designer process. Our Final Process will look like below screenshot:

tibco send mail process screenshot


Step 1: List PDF Files from the directory

For this tutorial, we are taking a directory into consideration where we have two PDF files already places. Create a Global Variable and save the path of that directory in the global variable.

Now use List Files activity from the Files Palette and in the input tab of this activity, map the global variable as shown below:

tibco send mail list files input mapping


The directory which is specified in our Gobal Variable (C:\test\*)  has two PDF files (ajmal.pdf and abbasi.pdf).


Step 2: Configure Send Mail Activity for Multiple Attachments

This is the key step of our tutorial. From Mail Palette, drag Send Mail activity in the process. In order to Send an email, you must have some SMTP Server access. For this scenario, I am using a free SMTP Server (by registering on smtpcorp.com). SMTP Host Name and User Name are being saved in Global Variables.

Send Mail configuration for my case is shown below:

tibco send mail with attachment configuration


Now move to the Input tab of Send Mail activity. Here we will map from and to email addresses from the Global Variables. Also specify some subject and body text for the email. In order to attach all the files listed through List File activity, use For-Each loop for the mimePart and map File Name to it. As our attachment is PDF, we specify application/pdf in the content type.

Complete input mapping for Send Mail activity is shown in below screenshot:

tibco send mail attachment input mapping screenshot


This completes all the required mappings and configurations of activities in our process. Now we will proceed to the next step in which we will run the process and test it.


Step 3: Run TIBCO Designer Process to Send Email with Attachments

Load the process in designer tester so that it starts automatically. As you can see in below screenshot, process has run successfully to its end without any error:

tibco test send mail attachment screenshot


You can verify the email with attachments by going into the email address which was specified in the MAIL_TO global variable.

Hope this tutorial will be helpful for you. Feel free to comment/contact for any further help. Thanks

Ajmal Abbasi

Ajmal Hussain Abbasi is Integration Consultant By Profession with more than 7 years experience in TIBCO products. He has extensive practical knowledge of TIBCO Business Works, TIBCO Spotfire, TIBCO BE, EMS and TIBCO ActiveSpaces. He has worked on a number of highly critical integration projects in Telecom sector by using his skills in Tibco Designer, Adapters, TIBCO EMS, RV, Administrator, TIBCO BE, TIBCO ActiveSpaces etc.
Ajmal Abbasi is also experienced in developing solutions using Oracle PL/Sql, Linux and Java.
You can contact Ajmal Abbasi for Consultancy, Technical Assistance and Technical Discussions.

More Posts - Website - Facebook - LinkedIn

20 thoughts on “TIBCO Send Mail Tutorial: How to Send Email With Multiple Attachments in TIBCO BW

  1. bhupendra


    Thanks you for posting great articles.

    I am getting error “.pdf is not a valid base64Binary. A valid example is AA==” while trying this example

    Complete error
    There is a binding error associated with activity. Send Mail
    BWENGINE-100030 Job-77000 Error in [test/Process Definition.process/Send Mail]
    Input data invalid
    caused by: org.xml.sax.SAXException: validation error: data “F:\test\APPND-ANF-ENG-PART1.pdf” is not a valid base64Binary. A valid example is “AA==”. ({com.tibco.xml.validation}SIMPLE_E_INVALID_VALUE_FOR_TYPE) at /{http://www.tibco.com/namespaces/tnt/plugins/mail}mailActivityInput[1]/{http://xmlns.tibco.com/encodings/mime}mimeEnvelopeElement[1]/mimePart[1]/binaryContent[1]
    com.tibco.xml.validation.exception.ValueParseException: data “F:\test\APPND-ANF-ENG-PART1.pdf” is not a valid base64Binary. A valid example is “AA==”.

  2. Saurabh Singh Negi

    Hi Sir,

    Thanks for the tutorial.
    I am able to send attachment through send email activity but attachment is coming with default name (ATT00001).
    Can we get attachment with the mapped file name.


    1. Ajmal Abbasi Post author

      Dear Saurabh,

      You can specify the attachment name in the field “contentDisposition”. Map file name to this field if you want actual file name to be used. Thanks

      1. Saurabh Singh Negi

        Hi Sir,

        Thanks for the reply.
        i have mapped the file name also but still getting the default name.
        can you please help me out on this


        1. Krishnarao

          I have tried to mapping the file but still getting the default file name..


          1. Ajmal Abbasi Post author

            In the content-disposition if you specify the value as concat(“*;filename=”,”Ajmal.txt”)

            you will get the attachment with the name ajmal.txt

  3. Krishnarao

    Hi Ajmal,

    I have tried like as file name
    here File name as complete path of the file

    tib:substring-after-last($Map-Data/FileName, “\”)

    in this logic also will get the correct file path but while attachment getting the by default value

  4. Krishnarao

    one more question:

    in from email id as ..@gmail.com
    to email id as …@Hotmail.com

    in this case how the smtp host will work because only one host using in configuration tab


    1. Ajmal Abbasi Post author

      SMTP host specified in the configuration is meant for the sender and has nothing to do with the recipient email address. If you are sending email from gmail account; SMTP configurations should be for gmail irrespective of the “to” email address domain. Thanks

  5. jyoti

    I am getting below error,
    “BW-MAIL-100019 Job-142000 Error in [TestProcesses/Send Mail with Attachment.process/Send Mail With Attachment]
    Error sending mail message. Cause: javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
    nested exception is:
    java.net.ConnectException: Connection refused: connect”

    kindly help

  6. Andrew Walker

    Hi Ajmal,
    I am trying to have Tibco send two email attachments of different types. I have the list file activity giving me both the .Xml and .pdf files I need, however my problem is how to get two different mime types in a single email. I used an if-then-else logic to choose when to put ‘application/pdf’ or ‘application/xml’ but it is not working.

    1. Ajmal Abbasi Post author

      It is quite simple. You just duplicate mimepart by right clicking and choosing “duplicate” option. That way you will have two (or any number of attachments you want) mimeparts. Then in every mimepart, do the mappings and configurations as per your need. E.g. if your one attachment is pdf type; choose content type as application/pdf and if another attachment is of simple txt format; you can choose text/* in the content type.

  7. Alec


    I am getting a “java.io.FileNotFoundException: (Access is denied)” error. I am sure the folder location is mapped correctly, and I have tried hard coding the file location (instead of global variables), but still does not work.

    Is there a permission somewhere that needs to be set for TIBCO Designer to access this directory?

    1. Ajmal Abbasi Post author

      Dear Alec,

      Make sure that file is accessible for the user which is running the designer. The best option for you to test is to run the designer with administrator user or else; change permissions of the file so that the user which you are using to run the designer is allowed access to the file. Thanks

  8. Susmitha


    I am retrieving data from Database table and in which one column data has comma..I am trying to send the table data as an csv attachment in send mail activity.I tried surrounding the specific column data with double quotes..But it is not working..the column data is being tokenised as multiple columns in the csv file.

    It would be great if you can help me with this.

  9. Chandra

    We are sending email with pdf attachement and HTML body.
    we have provided configurations like below
    content type: ‘text/html’;charset=’UTF-8′
    but for Japanese and Hungarian languages , the default encoding is taking and mail is not as expected, unexpected data id adding the the body.

    Please suggest me the content type or any other solution.


Leave a Reply

Your email address will not be published. Required fields are marked *