Question
Areteans
AU
Last activity: 17 Feb 2017 5:29 EST
How to decode base64 file when sending as an attachment in email
Hi Team,
I have a requirement to send an email with attachments, whenever a work case gets created and attachment is available.
For that, i am encoding the attachment to base64 (purpose of data loss) and sending an email.
Now the mail has been sent with attachment, but is in encoded format. Ex: µë-µë-µë-µë-(test test test test)
Is there anyway to decode it?
Thanks,
Divya Sri Padarthy
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
BlueRose Technologies
SE
Hi Divya,
Can you please try using SendEmailWithAttachments or SendEmailWithAllAttachments activity for your scenario.
Thanks,
Prudhvi
Areteans
AU
Hi Prudhvi,
I am using the same activity, but my problem is the reciepent is recieving the mail with attachment in encoded format.
Please suggest.
Thanks,
Divya Sri Padarthy
BlueRose Technologies
SE
Hi Divya sri,
I have used the activity in a flow as below and I am getting all the attachments as expected. Can you please share the configuration details.
Areteans
AU
Hi Prudhvi,
Actually we will pick the files using the file listener and later we need to create a case and attach this file to that case.
Later we need to send an email with this attachment.
I am handling everything in service activity.
Thanks,
Divya Sri Padarthy
Pegasystems Inc.
IN
when you are encoding the data, i think you need to set the property pydecode to true on the page of attachment pagelist that correspond to your attachment
Areteans
AU
Hi Nagendra,
This property will be set to "true" in SendEmailWithAllAttachments OOTB activity.
So, i think no need of setting this value explicitly.
Thanks,
Divya Sri Padarthy
Areteans
AU
Hi Team,
Any update on this query.
Thanks,
Divya Sri Padarthy
Areteans
AU
Hi Team,
Any Update on this issue.
Thanks,
Divya Sri Padarthy
Areteans Technology Solutions
AU
May i know the type of file that is supposed to be sent? I recall that only pdfs needs to be encoded and the rest need not be. Also check if the AttachmentPage has pyDecode set to true. I think we need to explicitly set is as true. Let me know if it works.
Areteans
AU
Hi Ratan,
I am trying to attach text file and it contains data like "test test test test".
Able to attach the file and send email successfully.
But when trying to open the file from attachments of an email, it is showing data in encoded format.
Ex: µë-µë-µë-µë-(test test test test)
Let me know how to decode it.
Thanks,
Divya Sri Padarthy
Areteans Technology Solutions
AU
Divya,
Since you are testing now, i am assuming that you are having only 1 embedded page in the AttachmentPage (Data-EmailAttachments)i.e
AttachmentPage.pyAttachments(1).pyData = "test test test"
AttachmentPage.pyAttachments(1).pyType = "txt"
AttachmentPage.pyAttachments(1).pyDecode = "false"
AttachmentPage.pyAttachments(1).pyName = "Attachment"
Can you confirm if this is the page structure that you are looking at? First, let's try sending the file data without encoding it. If we are successful then let's encode the data before setting it into the pyData property and changing the value in pyDecode from "false" to "true".
Regards,
Ratan Balaji.
Areteans
AU
Hi Ratan,
I will be having only one attachment for one email.
I am not encoding the data explictly. I am just using SendEmailwithAllAttachments activity to achieve my requirement.
But i am getting data in encoded format.
I have tried by seting the pyDecode property to true and false also.
Even though facing the same issue.
Thanks,
Divya Sri Padarthy
Areteans Technology Solutions
AU
Confirm if this is how the code is before calling the SendEmailNotificationWithAttachment Activity is being called.
Areteans
AU
Hi Ratan,
My requirement is like I need to pick the file from the particular source location.
And then create case,attach the file to case and send an email with this attachment.
For that, I have configured File Listener and the complete logic is configured in service activity.
In Service activity, i am trying to call the "SendEmailwithallattachments" activity. It's not working for me.
Are you calling "SendEmailwithallattachments" activity from flow?
Thanks,
Divya Sri Padarthy
Incessant Technologies
IN
I am not sure if decoding issue is solved or not but for decoding you should try use @Default.Base64Decode which inturn relies on Base64Util.decode() to decode a Base64 encoded string.