Question:How To Send An Email Using VB Script

Answer: If you need to create a task that sends an email using VBS script you can use the following .vbs script.

This script is a .vbs script that sends an email using a remote SMTP server.

In my case the remote SMTP server is Exchange Server however you don’t have to use Exchange server in order to get the script to work.

To use the script just change the text that is bold and make sure you have the SMTP server details.

After you fill in all the details save the file as .vbs and run it.

Set objEmail = CreateObject(“CDO.Message”)

objEmail.From = “MONITOR@YOURDOMAIN.COM

objEmail.To = “ADMIN@ YOURDOMAIN.COM

objEmail.Subject = “Subject Text

objEmail.Textbody = “Body Test

objEmail.Configuration.Fields.Item _

(“http://schemas.microsoft.com/cdo/configuration/sendusing”) = 2

objEmail.Configuration.Fields.Item _

(“http://schemas.microsoft.com/cdo/configuration/smtpserver”) = _

MAILSERVER.YOURDOMAIN.COM

objEmail.Configuration.Fields.Item _

(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”) = 25

objEmail.Configuration.Fields.Update

objEmail.Send



Posted

in

by