Question

1
Replies
420
Views
Devi Priya Venkatesan (DEVIPRIYAV)
Areteans
Senior Consultant
Areteans
IN
DEVIPRIYAV Member since 2012 1 post
Areteans
Posted: November 30, 2017
Last activity: December 5, 2017
Posted: 30 Nov 2017 5:40 EST
Last activity: 5 Dec 2017 9:33 EST
Closed

Cant able to send a email with an attachment in pega 6.1SP2

Hi ,


Facing technical challenge in adding attachments in email. Taking values from Data Base and creating CSV file. I have used SendEmailWithAllAttachments and SendEmailNotifications Activity to send a mail with an attachments which i have created. I can able to send a mail but i cant able to attach the file. This is BRE(Business rule Engine) Application. We are not using flows.


While using the above mentioned OOTB Methods getting error like:

Caught javax.mail.MessagingException, IOException while sending message.

Show More

Hi ,

Facing technical challenge in adding attachments in email. Taking values from Data Base and creating CSV file. I have used SendEmailWithAllAttachments and SendEmailNotifications Activity to send a mail with an attachments which i have created. I can able to send a mail but i cant able to attach the file. This is BRE(Business rule Engine) Application. We are not using flows.

While using the above mentioned OOTB Methods getting error like:

Caught javax.mail.MessagingException, IOException while sending message.

the above OOTB activities are not working. So i tried with the below java code:
java.io.FileInputStream fileInputStream = null;
java.io.File file = new java.io.File("CostValues.pyDescription"); // FileOpenPath .. file location
byte[] bFile = new byte[(int) file.length()];
long myFileLenghth = file.length();

try {

fileInputStream = new java.io.FileInputStream(file);
fileInputStream.read(bFile);
fileInputStream.close();

}catch(Exception e)
{
tools.getPrimaryPage().addMessage( e.getMessage() );
}
ClipboardPage page_EmbedAttachment = null,
page_AttachmentPage = tools.findPage("AttachmentPage");
String attachmentData = Base64Util.encodeToString(bFile, false);
ClipboardProperty prop_pyAttachment = null;
try {
prop_pyAttachment = page_AttachmentPage.getProperty(".pyAttachments(<append>)");
page_EmbedAttachment = prop_pyAttachment.getPageValue();
page_EmbedAttachment.putString(".pyData","attachmentData");
page_EmbedAttachment.putString(".pyName","Test.csv");
page_EmbedAttachment.putString(".pyDecode","true");
page_EmbedAttachment.putString(".pyRemoveXML","false");
} catch (Exception e) {
tools.getPrimaryPage().addMessage( e.getMessage() );
}
the above code also haven't worked. Getting the below error:
"The method encodeToString(byte[]) in the type Base64Util is not applicable for the arguments (byte[], boolean)"

Error Message
When using the java code facing the below error:
"The method encodeToString(byte[]) in the type Base64Util is not applicable for the arguments (byte[], boolean)"

Show Less
Low-Code App Development Data Integration Java and Activities
Moderation Team has archived post, This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Question, please write a new Question.