How can I send an email message from within a VBScript script?

John Savill

June 14, 2005

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. If you have Microsoft IIS with SMTP installed on a server, you can use the following code to send a basic email message from within a script:

Set objMessage = CreateObject("CDO.Message") objMessage.Subject = "Subject"objMessage.Sender = "[email protected]"objMessage.To = "[email protected]"objMessage.TextBody = "Your identity is compromised."objMessage.Send

(Substitute your own email information and message text.) You can insert this code into any script that requires a message to be sent.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like