cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to create 2 separate attachments via Java Mapping and send it via email

Former Member
0 Kudos

Hello All,

I am using the following java mapping to create 2 separate attachments . But unfortunately I am getting the same attachment with content as :(This is the first file)  twice in my email .

I want to get two separate files : file 1 -> This is the first file  in the email attachment.

                                                file 2 -> This is the 2nd file.

 

 

OutputAttachments outputAttachments = arg1.getOutputAttachments();

OutoutAttachments outputAttachments1 = arg1.getOutputAttachments();

Attachments attachments = outputAttachments.create("1","text/plain","This is the first file".getBytes());

Attachments attachments1 = outputAttachments1.create("2",tex/plain","This is the 2nd file".getBytes());

outputAttachments.setAttachment(attachments);

outputAttachments1.setAttachment(attachments1);

Regards

Vinay

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

Can you try:

OutputAttachments outputAttachments = arg1.getOutputAttachments();

Attachments attachments = outputAttachments.create("1","text/plain","This is the first file".getBytes());

attachments = outputAttachments.create("2",tex/plain","This is the 2nd file".getBytes());

outputAttachments.setAttachment(attachments);

Hope this helps,
Mark

Answers (1)

Answers (1)

anandvithal
Active Participant
0 Kudos

Hi,

Try this

.

.

Attachment att2 = out.getOutputAttachments().create("content id1","text/plain;charset=\"UTF-8\";filename=\"attch1.txt\"","first attachment".getBytes());

Attachment att2 = out.getOutputAttachments().create("content id2","text/plain;charset=\"UTF-8\";filename=\"attch2.txt\"","second attachment".getBytes());

out.getOutputAttachments().setAttachment(att1);

out.getOutputAttachments().setAttachment(att2);

.

.

Thanks,

Anand