Skip to content

qie.sendEmailFrom

Signature: qie.sendEmailFrom(from, username, password, to, cc, bcc, replyTo, subject, body, attachments*)

Returns: void

Send an email message from a different address than what is configured in the system config page (This does throw an exception if the email did not send successfully).

Note

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

Parameters

Type Name Description Default
String from email address to send from
String username username for logging into the mail server
String password password for logging into the mail server
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 null

Example

// Define the email details
var from = "support@qvera.com";
var username = "username";
var password = "password";
var to = "support@qvera.com,awesomesupport@qvera.com";
var cc = "others@qvera.com,personne@qvera.com";
var bcc = "blindcc@qvera.com";
var replyTo = "george@qvera.com,ronald@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 attachments = {
   "Report.pdf": qie.readFile("C:/temp/test.pdf")
};

// Send the email
try {
   qie.sendEmailFrom(from, username, password, to, cc, bcc, replyTo, subject, body, attachments);
   qie.warn("Email sent successfully.");
} catch (e) {
   qie.error("Failed to send email: " + e.message);
}