Forum Discussion

NickE's avatar
NickE
New Contributor II
4 years ago

Read .txt file with HTML code for email body to send an email

Hello,

I am trying to configure an email sender snap which has reads the HTML code for the body of the email downstream. Currently, the HTML is in a .txt file in the groundplex, therefore I am using file reader to pick up the file but I do not know how to convert binary and then feed into the email sender snap.

Thank you very much for your help

9 Replies

  • SpiroTaleski's avatar
    SpiroTaleski
    Valued Contributor

    @NickE

    Once you read the .txt file, try with Binary to Document Snap, setting “encode or decode” to NONE.

    The output from the binary to document snap will contain the content of the file(under the content field).

    Regards,
    Spiro Taleski

  • NickE's avatar
    NickE
    New Contributor II

    Hi Spiro,

    Thank you so much for you quick solution. That has successfully read the text file and outputting valid data. To read the code into the ‘Template body’ section of the email sender snap, I am using $ however it output email sender is ‘null’

    Thanks so much again

    Nick

  • NickE's avatar
    NickE
    New Contributor II

    Would you use a mapper after the binary to document?

    • SpiroTaleski's avatar
      SpiroTaleski
      Valued Contributor

      @NickE

      The Binary to Document Snap apart from “content” field as an output gives additional details like “content-type” etc. You can directly get the “content” field in the Email Sender Snap(that will not cause any issues). But if you want to exclude any additional fields produced by Binary to Document Snap, then you can use mapper after binary to document, to map the necessary fields.

      Regards,
      Spiro Taleski

      • NickE's avatar
        NickE
        New Contributor II

        Hi Spiro,

        Thank you very much. I managed to get this working (there was an issue upsteam which wasn’t pulling through the targets on the mapper).
        I have now encountered an issue that the output of the binary to document has replaced the tabs and newlines with \t and \n. I am trying to use the csv formatter and parser to recreate the data as it should be but I am stuck.
        Many thanks