To use this function add it to the class library file named OrchestratorService.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: OrchestratorService.ts
Functions: SendEMailWithAttachment
Description: The following is the script to send an e-mail with an attachment.
public SendEMailWithAttachment(strSubject:string, strToAddress:string, strContent:string, strAttachmentFileName:string, strAttachmentFileContent:string): void {
let objMimeAttachment:MimeAttachment = new MimeAttachment();
objMimeAttachment.name = strAttachmentFileName;
objMimeAttachment.content = strAttachmentFileContent;
let objEmailMessage:EmailMessage = new EmailMessage();
objEmailMessage.fromAddress = "orchestrator@cloudbuildtools.com";
objEmailMessage.fromName = "Orchestrator";
objEmailMessage.smtpHost = "smtp.cloudbuildtools.com";
objEmailMessage.smtpPort = "25";
objEmailMessage.subject = strSubject;
objEmailMessage.toAddress = strToAddress;
objEmailMessage.addMimePart(strContent, "text/html");
objEmailMessage.addMimePart(objMimeAttachment, "application/json; charset=UTF-8");
objEmailMessage.sendMessage();
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
