Skip navigation

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

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.
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish