Do not install SMTP service to send email [WSH] [Enterprise Script]
Send Email without Installing The SMTP Service
Description
Demonstration Script That Uses CDO To Send Email from a Computer Where The SMTP Service Has Not Been Installed. Designed to Work On Microsoft's Corporate Network.
Script code
Set Objemail = CreateObject ("cdo.message")
Objemail.From = "admin1@fabrikam.com"
Objemail.to = "admin2@fabrikam.com"
Objemail.subject = "Server Down"
Objemail.TextBody = "Server1 is no longer accessible over the network."
Objemail.configuration.fields.Item_
("http://schemas.microsoft.com/cdpo/configuration/sendusing") = 2
Objemail.configuration.fields.Item_
("http://schemas.microsoft.com/cdpo/configuration/smtpserver") = _
"smarthost"
Objemail.configuration.fields.Item_
("http://schemas.microsoft.com/cdpo/configuration/smtpserverport") = 25
Objemail.configuration.fields.Update
Objemail.send
For online peer support, join the microsoft.public.windows.server.scripting community on the msnews.microsoft.com news server. To provide feedback or report bugs in sample scripts or the Scripting Guide, please contact Microsoft TechNet.