Kann nicht senden Sie E-mail mit smtp.gmail.com, port 587 von vbs-Skript
Ich bin versucht, senden Sie eine E-mail über ein vbs-Skript, aber es funktioniert nicht. Ich bin mit server smtp.gmail.com und port 587. Die Wehr Sache ist, dass dies funktioniert wenn ich den port ändern auf 25. Unten ist der code, den ich verwende:
SMTPMail "to", "cc", "TEST", "TEST"
Function SMTPMail(ByVal sTo, ByVal sCc, ByVal sSubject, ByVal sBody)
Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).
Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM
Dim objMessage
set objMessage = CreateObject("CDO.Message")
objMessage.Subject = sSubject
objMessage.Sender = "sender"
objMessage.From = "from"
objMessage.To = sTo
objMessage.CC = sCc
objMessage.TextBody = sBody
'==This section provides the configuration information for the remote SMTP server.
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
'Server port (typically 25)
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username"
'Your password on the SMTP server
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update()
objMessage.Send()
End Function
Vielen Dank im Voraus.
Du musst angemeldet sein, um einen Kommentar abzugeben.
Gmail-Nutzer können auf Ihr Konto auf der offiziellen website oder durch die Verwendung von first-party oder third-party-apps und-Dienste statt. Ein first-party-app ist zum Beispiel Google die offizielle Google Mail-app für Android, während Thunderbird und die E-mail-client-app für Windows 8 sind apps von Drittanbietern.
Google angekündigt wieder im April 2014, dass dies zu einer Verbesserung der Zeichen-in die Sicherheit seiner Dienste und die Auswirkungen auf die Anwendung sendet auch Benutzernamen und Passwörter für das Unternehmen.
Dem Unternehmen vorgeschlagen, um Schalter zu OAuth 2.0 damals aber nicht durchsetzen-bis jetzt.
Wenn Sie öffnen Sie die neue weniger sicher apps-Seite unter "Sicherheit" die Einstellungen auf Google, Sie werden feststellen, dass Google den Zugriff gesperrt hat standardmäßig.
Hinweis: Sie sehen nur die Seite, wenn Sie nicht mit Google Apps oder aktiviert zwei-Faktor-Authentifizierung für das Konto.
Können Sie den Schalter zum aktivieren hier weniger sichere Anwendungen wieder, so dass der Zugang wieder hergestellt ist.
Andere Sache, der verwendete port ist 465 und nicht 587
So können Sie versuchen, das vbscript, das funktioniert für mich mit dem port 465