I have a case where receiving XML files with base64 (e.g. PDF)files inside the file which ones do I want to send as attachments in an email with Email Send connector (Template mode)
Unfortunately, you will not be able to use the Template mode of the EmailSend connector to dynamically generate a message with attachments - so it will not be possible to send a single message that contains your PDFs as attachments.
There is code that you can use in a previous step in the flow to scan this XML file, and decode and output the pdf’s as invidual messages. To do this, you’d need to use the xmlDOMSearch and encDecode operations to search the incoming document and output each file individually - you can also add headers to the message if there are other elements you need for the email body:
<!-- look for XPaths in the document --><arc:set attr="xml.uri" value="[filepath]" /><arc:set attr="xml.xpath" value="/ForwardingInstructions/cac:DocumentReference" /><arc:call op="xmlDOMSearch" in="xml"> <arc:if exp="[xpath('cbc:Status') | def | equals('Document')]"> <!-- here, you can add any other headers if you need more metadata in the email step --> <arc:set attr="output.header:ID" value="[xpath(cbc:ID)]"/> <!-- this code decodes the base64 data to a temp path on disk you'll need write permissions here --> <arc:set attr="output.filename" value="[xpath(cac:Attachment/cac:ExternalReference/cbc:Filename)]" /> <arc:set attr="enc.data" value="[xpath(cac:Attachment/cbc:EmbeddedDocumentBinaryObject)]" /> <arc:set attr="enc.outfile" value="C:\\Temp\\[output.filename]" /> <arc:set attr="enc.format" value="BASE64" /> <arc:call op="encDecode" item="enc" /> <!-- this outputs the pdf as a new message --> <arc:set attr="output.filepath" value="[enc.outfile]" /> <arc:push item="output" /> <!-- clean up the temp file --> <arc:set attr="del.file" value="[enc.outfile]" /> <arc:call op="fileDelete" item="del"/> </arc:if></arc:call>
But note that this would output one file per PDF and each would send as a separate message in EmailSend in Attachment mode.
This website stores cookies on your computer. These cookies are used to collect information about how you interact with our website and allow us to remember you. We use this information in order to improve and customize your browsing experience and for analytics and metrics about our visitors both on this website and other media.
Review section III of our Privacy Policy for more information on cookies.
To opt out of “sale” or “sharing” of non-cookie data, visit our Privacy Rights Request Form.