【发布时间】:2014-10-20 05:59:55
【问题描述】:
我已经尝试了以下代码,没有抛出错误。也没有发送任何电子邮件。
Dim i, objEmail
' Use custom error handling
On Error Resume Next
Set objEmail = CreateObject( "CDO.Message" )
' Fill in the field values
With objEmail
.From = "xyz@abc.com"
.To = "pqr@abc.com"
.Subject = "Test"
.TextBody = "Email from VB Script"
If mySMTPPort = "" Then
mySMTPPort = 25
End If
With .Configuration.Fields
.Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ) = 2
.Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ) = "HostNameHere"
.Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ) = 25
.Update
End With
.Send
End With
' Return status message
If Err Then
EMail = "ERROR " & Err.Number & ": " & Err.Description
Err.Clear
Else
EMail = "Message sent ok"
End If
' Release the e-mail message object
Set objEmail = Nothing
当我执行这个 VBS 文件时,它什么也不做。请帮帮我。我必须将简单的文本电子邮件从我的域发送到另一个域。或者我想要执行的任务是否有解决方法?
【问题讨论】: