Email VBS

Nur zur dokumentation, falls mal jemand eine Mail aus der von einem Windows-Rechner aus einem Script senden will. Das hier in eine Datei packen, mailserver, from und to einstellen, als .vbs speichern und ausführen.

Set mailing = CreateObject("CDO.Message")

' Configuration
mailing.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
mailing.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mailserver"
mailing.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
mailing.Configuration.Fields.Update

' Actual Content
mailing.From = "sender@example.com"
mailing.To = "test@example.com"
mailing.Subject = "Script-Mail!"
mailing.TextBody = "Hallo Welt"

'Sending
mailing.Send

Comments are closed. Please feel free to Contact me directly!


Author

Claudius Coenen is a tech-enthusiast. He's writing on all kinds of topics, including programming, technology, gadgets and media.

This site features his occasional articles, findings, documentations.

Categories

Connect

RSS Recent Bookmarks

Legal