Use CDO Send Mail In DOS

Set   objEmail = CreateObject("CDO.Message")
Const CDONameSpace = "http://schemas.microsoft.com/cdo/configuration/"

With objEmail.Configuration.Fields
.Item(CDONameSpace+"sendusing") = 2
.Item(CDONameSpace+"smtpserver") = "smtp.21cn.com"
.Item(CDONameSpace+"smtpserverport") = 25
.Item(CDONameSpace+"smtpauthenticate") = 1
.Item(CDONameSpace+"sendusername") = "sleepwom"
.Item(CDONameSpace+"sendpassword") = "123456"
End With

With objEmail
.From     = "[email protected]"
.To       = "[email protected]"
.Subject  = "Server down"
.Textbody = "Server1 is no longer accessible over the network."
End With

objEmail.Configuration.Fields.Update
objEmail.Send

Msgbox "success"

Set objEmail = Nothing

你可能感兴趣的:(Use CDO Send Mail In DOS)