Email - Attach Input File with Email Context

With the Send Email plugin there is the option to easily attach the input file. The design of the email is rather limited without entering in HTML code though.

With the Create Email Content plugin there is much more control over the email appearance, but I do not see an easy method to simply attach the input file.

In this specific instance, the workflow is receiving a PDF file. A notification needs to be sent with the attached PDF file. The PDF file does not contain any variable data. The notification go to a static email address. They want specific styling in the body of the email.

I have another instance where I receive a text file. This text file contains a report number that is used to perform a database lookup to retrieve an email address. The body of the email is desired to contain an action, but the text file which is the input needs to be attached as the text file.

Am I missing something? What is the easiest method to perform this?

Defining what gets attached to the email is primarily done within the Connect Template itself. See the following link for examples of working with Dynamic Attachments

http://help.objectiflune.com/en/planetpress-connect-user-guide/2019.1/#designer/Email/Attachments.htm

What you could do is to drop a copy of your data file into a temp location and then pass the path/filename to the template via a workflow variable. When the Email template executes, it will pull that file in and add it as an attachement.

While I would prefer a check box to attach the input file. I will use the save to a folder and then pull the external file back in.

Is there a way to rename the attachment after it is picked up? This way I can deposit all of the files in the same folder with %u, but email them as “My PDF file name.pdf”.

I will also need to build a cleanup method to delete the now external pdf file after emailing.

Sorry, at first I didn’t see the reference to renaming in the link. This is what I have basic setup which appears to be working.

  • Defined field named OriginalName in Extract Action with “automation.properties.OriginalFilename;”
  • Created Local Workflow variable named sOrigFileName
  • Defined a Preprocessor named sOrigFileName as a automation variable
  • Defined field named sOrigFileName in Extract Action with “automation.variables.sOrigFileName;”

Email Attachment script

var field, result = “”;
field = record.fields[“OriginalName”];
if (field !== “”) result += “file:///C:/Attachments/” + field;

results.append(query(“”).attr(“title”, record.fields.sOrigFileName).attr(“href”, result));

The first thing the workflow process does is to preserve %o in a local variable sOrigFileName. The some manipulation and other actions, the workflow process does a rename of the incoming PDF file as sUnique which is loaded with %u and stores the file in the C:\Attachments directory. This effectively sets the OriginalName to sUnique.