Create a simple message and send it with the SMTPClient Object
' Example: CSMail VBScript Example 1
' Summary: Create a simple message and send it with the SMTPClient Object
' Usage: cscript exvbs01.vbs
' or
' wscript exvbs01.vbs
set MyMsg=CreateObject("CSMail.Message") ' Create the message object
MyMsg.Subject="Medical Officer's Report" ' Set the message subject
MyMsg.To(1)="kirk@enterprise.com" ' Set the recipient...
MyMsg.From(1)="bones@enterprise.com" ' ... and the originator
MyMsg.Sections(1).Body="Its life Jim, but not as we know it."
' Set the message body text
set SMTP = CreateObject("CSMail.SMTPClient") ' Create an SMTP Client Object
SMTP.Connect("127.0.0.1") ' Connect to the server - in this case the local machine
SMTP.SendMessage(MyMsg) ' Send the message
SMTP.Close ' Close the server
|