2015-08-08 116 views
-2

所以我想發送一封電子郵件來檢查垃圾郵件過濾器。但是,它不斷給我錯誤消息。如如何使用VBS垃圾郵件

could not connect to STMP server

請幫我改進一下。

Dim User 
Dim Pass 
Dim Name 
Dim Input 
Dim Input2 
Dim Input3 
X=MsgBox("Welcome. To log in Please Click OK and enter your G-mail & pass.",0,"EmailSpamBot V1.0") 
User = InputBox("Enter your G-mail:") 
Pass = InputBox("Enter Password:"& vbCrLf & ""& vbCrLf & "Please note passwords are NOT stored in this script and are case sensitive.") 
Name = InputBox("Enter Name:") 
Input = InputBox("Enter e-mail of victim:") 
Input2 = InputBox("Enter title:") 
Input3 = InputBox("Enter message:") 
EmailSubject = (""& Input2) 
EmailBody = (""& Input3) 

'Const EmailFrom = "" 
'Const EmailFromName = "" 

Const SMTPServer = "smtp.gmail.com" 
'Const SMTPLogon = "" 
'Const SMTPPassword = "" 
Const SMTPSSL = True 
Const SMTPPort = 465 

Const cdoSendUsingPickup = 1 'Send message using local SMTP service pickup directory. 
Const cdoSendUsingPort = 2 'Send the message using SMTP over TCP/IP networking. 

Const cdoAnonymous = 0 ' No authentication 
Const cdoBasic = 1 ' BASIC clear text authentication 
Const cdoNTLM = 2 ' NTLM, Microsoft proprietary authentication 

' First, create the message 

Set objMessage = CreateObject("CDO.Message") 
objMessage.Subject = EmailSubject 
objMessage.From = "<" & User & Name & ">" 
objMessage.To = "<" & Input & ">" 
objMessage.TextBody = EmailBody 

' Second, configure the server 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/sendusername") = User 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = Pass 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPort 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = SMTPSSL 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 

objMessage.Configuration.Fields.Update 

do 
ObjMessage.Send 
loop 

任何幫助將大大appreciatied

+0

我得到不同的錯誤'錯誤:\t郵件無法發送到SMTP服務器。傳輸錯誤代碼是0x80040217。服務器響應不可用 – Zam

回答

0

錯誤消息「無法連接到SMTP服務器」是指你的腳本無法建立遠程主機上的指定端口的連接。這通常發生在防火牆阻止訪問時。您可以驗證與telnet命令:

telnet smtp.gmail.com 465 

如果訪問被封鎖,你應該expiered超時後,得到了下面的輸出:

Connecting To smtp.gmail.com...Could not open connection to the host, on port 465: Connect failed

tracetcp的工具可能會提供進一步的洞察力到數據包被阻塞的地方。

但是,發送經過身份驗證的郵件通常用於提交出站郵件。如果您想測試自己的垃圾郵件過濾器,則應該發送入站郵件(到端口25)。

0

我想出了問題,當你輸入你的電子郵件,五分鐘左右後,你會收到一封有關安全性較低的應用試圖訪問的安全郵件,那就是VBS腳本,你點擊啓用安全性較低的應用訪問,然後它工作。