qie.sendEmailWithCC¶
Signature: qie.sendEmailWithCC(to, cc, bcc, replyTo, subject, body, attachments*)
Returns: void
Send an email message with cc (This does throw an exception if the email did not send successfully).
Note
See this KB article for examples of adding attachments.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String | to | comma separated email addresses | |
| String | cc | comma separated email addresses | |
| String | bcc | comma separated email addresses | |
| String | replyTo | comma separated email addresses | |
| String | subject | email subject line | |
| String | body | email message body | |
| emailAttachmentMap | attachments* | (optional) file attachments |
Example¶
// Define the email details
var to = "support@example.com,awesomesupport@example.com";
var cc = "others@example.com,personne@example.com";
var bcc = "blindcc@example.com";
var replyTo = "george@example.com,henry@example.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 attachments = {
"Report.pdf": qie.readFile("/tmp/test.pdf")
};
// Send the email
try {
qie.sendEmailWithCC(to, cc, bcc, replyTo, subject, body, attachments);
qie.warn("Email sent successfully.");
} catch (e) {
qie.error("Failed to send email: " + e.message);
}