How can I send an e-mail from a vbs script – on a machine that cannot connect to the internet (it’s in my non-internet zone).
I’ve hacked the following together from my googling, but is seems to require a call to Microsoft’s server. What about the situation where I’m not able to reach microsoft.com?
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(sch & "sendusing") = 2 ''cdoSendUsingPort
.Item(sch & "smtpserver") = "my_internal_mail_server"
.update
End With
Set objEmail = CreateObject("CDO.Message")
set objEmail.configuration = cdoConfig
objEmail.From = "me@example.com"
objEmail.To = "me@example.com"
objEmail.Subject = "Server is down!"
objEmail.Textbody = "Run out the guns!!!"
objEmail.Send
MsgBox "Script Complete"
(I have an internal SMTP server… the problem is having to poll the MS server)
You need a SMTP server that is accessible from where your script will run that knows how to send the email to where it needs to go. You can configure IIS or Exchange to do SMTP (or any number of open source projects), but it needs to be configured so it can relay the email to where it needs to go.
EDIT: I was under the impression that the schema was just a namespace for the configuration fields, not something that it actually tried to load from a microsoft server. When you run it, giving it your internal smtp server name, what happens? Do you get an error?