Send Email by Script or Batch command

Tags: smtp

Sometimes you want to send Email using a Script or a batch file. You can use an external .exe as a tool, but if you have a SMTP-Server in your network reachable, you can use this simple vbs script. Just past in the following code in a Texteditor, modify the values for your Server and the Email-Addresses and save it as .vbs file. Then you can send email from automated tasks.

Set objEmail = CreateObject("CDO.Message")

objEmail.From = ""
objEmail.To = ""

objEmail.Subject = "Subject: Test – Email by script"
objEmail.Textbody = "This is the Messagetext"

objEmail.Configuration.Fields.Item("") = 2
objEmail.Configuration.Fields.Item("") = ""
objEmail.Configuration.Fields.Item("") = 25


Greets – Helmut

Add a Comment