email dynamic attachment to multiple addresses

Apologies if this is a basic request, but I’m under time pressure to complete.

Have a mail merged letter with different names/addresses that are required to be sent as a single attached PDF to each different email addresses.

I’ve set up a Print template and data mapper with that merges the data. I see there are different methods to process emails, either in Designer or Workflow. Tried a number of different approaches using Dynamic Attachment Script Wizard, but I’m not familiar with scripting. Also created an Email template. I can set this up in PP7 fine, but would like instruction on the simplest way to set up with Connect please? Thank you.

Hello Jonathan,

A possible solution is to generate the PDF file by OL Connect first, to store this PDF file in a specific directory and write the directory path to a Job Info- or Local variable. You can then use a Standard script like the below one to use the directory path written to the Job Info- or Local variable and attach the same PDF file to each individual email.

Standard script

Name: PDF attachment
Selector: html.HTML_EMAIL[section="Content"] head

var pdfFile = "";

//pdfFile = "file:///C:/OLCW/PDF-attachments/example-20251111153130.pdf";
pdfFile = automation.jobInfos.JobInfo9;

/**
 * Check if the variable `pdfFile` is not an empty string and if the file 
 * exists before adding the `<link>`-element to the `<head>`-element.
 */
if (pdfFile !== "" && resource(pdfFile)) {
	var elem = query("<link rel=related>");
	
	elem.attr("title", pdfFile.split("/").pop().split("\\").pop());
	elem.attr("href", pdfFile);
	
	results.append(elem);
}

Hi Marten, that’s great, many thanks for your help, much appreciated.

1 Like