cancel
Showing results for 
Search instead for 
Did you mean: 

Rename the zip file and send it using the Receiver Mail Adapter

Shabarish_Nair
Active Contributor
0 Kudos

Hi,

We have a custom module that will create multiple attachments. The result is then passed to the PayloadZipBean, which zips as per required.

When we output this to a file adapter, we provide the file name as say "zippedfile.zip" the result is as expected.

For example, if the custom module created 3 attachments with the names as file1.txt, file2.txt and file3.txt, the zip file zippedfile.zip, will contain 3 files as file1.txt, file2.txt and file3.txt.

The issue that we are facing is when we use the mail adapter, the zip file is getting renamed to file1.txt.zip i.e to say that it takes the name of the main payload from the custom module (file1.txt)

TextPayload txtpayload = message.getDocument();
txtpayload.setContentType("text/plain");
txtpayload.setName("file1.txt");
moduleData.setPrincipalData(message);

We tried using the MessageTransformbean but it doesn't seem to change the name of the file.

Not sure where we are going wrong. Is it that the output of the payloadzipbean cannot be used and altered by MessageTransformbean?

Is there any alternative as to rename the name of zipfiles and use it in the mail adapter?

Appreciate any help on this regard.

Regards,

Shabz

Accepted Solutions (0)

Answers (1)

Answers (1)

Shabarish_Nair
Active Contributor
0 Kudos

Solved.

use Transform.ContentDisposition - attachment;filename="youfilename"

Do read the mail adapter FAQ.

The parameter can vary for different mail client.

agasthuri_doss
Active Contributor
0 Kudos

Thanks for the information Shabarish.

Regards

Agasthuri Doss