vCO Workflow Script to Send an E-Mail with An Attachment

The following is the script to send an e-mail with an attachment.

 

var objMimeAttachment;
objMimeAttachment = new MimeAttachment();
objMimeAttachment.name = "DeploymentReport.pdf";
objMimeAttachment.content = strReportJson;

var objEmailMessage;
objEmailMessage = new EmailMessage();
objEmailMessage.fromAddress = "vco@vcoflow.co.uk";
objEmailMessage.fromName = "vCloud";
objEmailMessage.smtpHost = "smtp.vcoflow.co.uk";
objEmailMessage.smtpPort = "25";
objEmailMessage.subject = strSubject;
objEmailMessage.toAddress = strToAddress;
objEmailMessage.addMimePart(strContent, "text/html");
objEmailMessage.addMimePart(objMimeAttachment, "application/json; charset=UTF-8");
objEmailMessage.sendMessage();

Leave a Reply