2015-08-08 77 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脚本,你点击启用安全性较低的应用访问,然后它工作。