我試過了下面的代碼,沒有引發任何錯誤。也沒有郵件發送。使用VBscript發送文字電子郵件
Dim i, objEmail
' Use custom error handling
On Error Resume Next
Set objEmail = CreateObject("CDO.Message")
' Fill in the field values
With objEmail
.From = "[email protected]"
.To = "[email protected]"
.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文件時,它什麼也沒做。請幫助我。我必須從我的域發送簡單的文本電子郵件到另一個域。或者是否有我想要執行的任務的解決方法?
你想要一個批處理文件嗎? http://stackoverflow.com/questions/23010079/vb-script-for-send-mail/23011839#23011839 – foxidrive 2014-10-20 07:43:27