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.

InformationsquelleAutor user3815821 | 2015-02-19
Schreibe einen Kommentar