Skip to content

qie.addEmailAttachment

Signature: qie.addEmailAttachment(attachmentMap, attachmentName, file)

Returns: void

Adds an email attachment to the emailAttachmentMap.

Note

See this KB article for examples on how to include attachments.

Parameters

Type Name Description Default
Map<String, byte[]> attachmentMap email attachment map
String attachmentName name of the attachment that will show up in the email client
String or byte[] file file content

Example

// Define the email details
var to = "support@companyName.com,awesomesupport@companyName.com";
var subject = "Monthly Report";
var body = "Dear Team,\n" +
   "Please find attached the monthly report.\n\n" +
   "Best regards,\nQIE Admin";


// Create an attachment map
var attachmentMap = qie.newEmailAttachmentMap();


// Example: file as byte[]
var pdfBytes = qie.readFileBytes("C:/temp/test.pdf"); // byte[]
qie.addEmailAttachment(
   attachmentMap,
   "Report.pdf",
   pdfBytes
);


// Example: file as String (text content)
var textContent = "This is a simple text attachment.";
qie.addEmailAttachment(
   attachmentMap,
   "notes.txt",
   textContent
);


// Send the email (error handling omitted for brevity)
qie.sendEmail(to, subject, body, attachmentMap);