Sending emails with windows scripting host

You can send emails from within Windows scripting host with the following code (VBS in this case):

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "My Subject"
objMessage.From = "From Header"
objMessage.To = "Recipient Address"
objMessage.TextBody = "text in body"
objMessage.AddAttachment("Path/to/file")
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mailserver.example.com"
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send

This should work with all recent Windows versions, starting at least with Windows XP as CDO message gets installed by default.