Skip to content

qie.addEmailAttachmentWithFile

Signature: qie.addEmailAttachmentWithFile(attachmentMap, file)

Returns: void

Adds an email attachment to the emailAttachmentMap, using the file as the attachment. The attachment will be named the same as the file name.

Note

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

Parameters

Type Name Description Default
Map<String, byte[]> attachmentMap email attachment map
File file file object (java.io.File)

Example

// Define the email details
var to = "support@qvera.com,awesomesupport@qvera.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();
qie.addEmailAttachment(attachmentMap, "Report.pdf", qie.readFileBytes("C:/temp/test.pdf"));
qie.addEmailAttachmentWithFile(attachmentMap, qie.newFile("C:/temp/anotherTest.pdf"));

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