I re-read your post, and saw that you are using the Email Sender Snap.
I created a pipeline to test a similar scenario, and I have a couple solutions for you!!!
To isolate the flow, in my pipeline, I use a FileReader Snap to read a file from S3 (this assumes that I have previously written one to S3, as in your scenario). This Snap takes my AWS credentials, and my file handle (which is of the format: s3:///email@example.com/path/FileName)
I successfully read this file, but this of course produces a binary output. Next, I connect a BinaryToDocument Snap onto the FileReader. The encoding I choose is “NONE” This converts the File data into a platform specific characterset and loads it into a Java String.
I next connect a Mapper Snap to the BinaryToDocument. After I validate the (soon to be completed) pipeline, I then can see the generated source schema, which shows me “content” from my BinaryToDocument Snap. I mapped this to an output variable called “$body” although I probably could have just later referenced “$content”, but that was giving me troubles.
Next I connect my Email Sender Snap to the Mapper. I configure the account, etc etc etc, and in the body, I click the “=” sign and as my expression, I use “$body”. Now once I validate and execute the pipeline, my String data within the S3 File is emailed to me successfully!!!
Now, this was my proof of concept. Instead of using the FileReader…for your scenario I think the following would be more efficient:
I am assuming you are using an S3FileWriter to write your test_errrors*.json file to S3. In lieu of using the FileReader after writing the file, you can add an output view to your S3FileWriter, as per:
That would produce a document output, which could then be used in the Mapper that I described, to map the content to “$body” and consume that in the Email Reader Snap.
Now, you may already be consuming the outputView for your S3FileWriter Snap, but fear not; there is a way to handle this as well: You can connect the output of the S3FileWriter to a Router Snap (found in Flow Snappack). This has 2 outputViews by default. You can place this in between the S3FileWriter, and the Mapper. Set the expressions for the Router Snap to true. This will make it copy the output from the S3FileWriter to the new pipeline junction, which maps the content, and emails it…along with any former junction.
I hope this was helpful. Please reach out if you need any more info on this!