Workflow scripted elements can include scripting of common email-related tasks. You can cut, paste, and adapt these examples into your scripted elements.

When you run a mail workflow, it uses the default mail server configuration that you set in the Orchestrator configuration interface. You can override the default values by using input parameters, or by defining custom values in workflow scripted elements.

The following JavaScript example obtains the email address of the current owner of a running script.

var emailAddress = Server.getRunningUser().emailAddress ;

The following JavaScript example sends an email to the defined recipient, through an SMTP server, with the defined content.

var message = new EmailMessage() ; 
message.smtpHost = "smtpHost" ;
message.subject= "my subject" ; 
message.toAddress = "receiver@vmware.com" ; 
message.fromAddress = "sender@vmware.com" ;
message.addMimePart("This is a simple message","text/html") ;
message.sendMessage() ;