Industrial Automation
Industrial Automation | Europe

myKnowledge

Main > Product Type > Software > Visualisation
Minimize Text   Default    Enlarge Text
 

Print
E-mail

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.

 




Comments (View All Comments / Add Comment)

Related Articles
No related articles found.
Created 2008-09-11
Modified 2012-08-09
Views 6356

 

You are not logged in.