How To Send An Email Alert From A PC Using VB Script

Sending an automatic email can be achieved with the standard Microsoft object CDO.Message. This requires you to make use of the following sample VBScript:

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CX-Supervisor Message"
objMessage.From = "CX.supervisor@gmail.com"
objMessage.To = "operator@rainbowmachines.com"
objMessage.TextBody = "This is some sample message text."

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "CX.supervisor@gmail.com"
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword"

objMessage.Configuration.Fields.Update

objMessage.Send

This example uses a gmail account to send the message, you need to replace this with your own gmail username and password settings or your own smtp server.

This script can be used within CX-Supervisor or any other VB Script container.

 


Link:
http://www.myomron.com/index.php?action=kb&print=45



Comments  

Translate: