Hey everyone,
I am running the 'Relocate Virtual Machine Disk' workflow, and would like for it to generate a simple email stating which VM and what Datastore the new disks are living in. The text enlarged and in bold is what I had added to the original 'Send Notification' script. I would like a clean looking email without the "Dynamic Wraper" and Instance stuff.
Here is my 'Send Email' script:
var message = new EmailMessage();
// Override default settings if and only if input parameter is set
if ( smtpHost != null && smtpHost.length > 0 ){
message.smtpHost = smtpHost;
}
if ( smtpPort != null && smtpPort > 0 ){
message.smtpPort = smtpPort;
}
if ( username !=null && username.length > 0){
message.username = username;
}
if ( password != null && password.length > 0){
message.password = password;
}
if ( fromName != null && fromName.length > 0){
message.fromName = fromName;
}
if ( fromAddress != null && fromAddress.length > 0){
message.fromAddress = fromAddress;
}
message.toAddress = toAddress;
message.subject = subject;
message.addMimePart( "Virtual Machine: " + vm + "Relocated disk to: " + datastore, "text/html; charset=UTF-8");
System.log( "sending mail to host: " + message.smtpHost + ":" + message.smtpPort + " with user:" + message.username
+ ", from:" + message.fromAddress + ", to:" + message.toAddress );
message.sendMessage();
And this is the email that I am receiving:
Virtual Machine: DynamicWrapper (Instance) : [VcVirtualMachine]-[class com.vmware.vmo.plugin.vi4.model.VimVirtualMachine] -- VALUE : VirtualMachine'Test VM'Relocated disk to: DynamicWrapper (Instance) : [VcDatastore]-[class com.vmware.vmo.plugin.vi4.model.VimDatastore] -- VALUE : Datastore'Windows_Lab'