_INetSmtpMailCom funktioniert nicht mehr

  • Guten Abend.

    Ich habe vor einiger Zeit (etwa 4 Monaten) folgendes Script benutzt um Mails zu verschicken.

    Spoiler anzeigen
    [autoit]

    #include <_INetSmtpMailCom.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $oMyRet[2]
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

    [/autoit] [autoit][/autoit] [autoit]

    $SmtpServer = "smtp.web.de"
    $FromName = "MyName"
    $FromAddress = "my_mail@web.de"
    $ToAddress = "other_mail@web.de"
    $Subject = @UserName
    $Body = "Body"
    $AttachFiles = ""
    $CcAddress = ""
    $BccAddress = ""
    $Importance = "Normal"
    $Username = "my_mail@web.de"
    $Password = "my_password"
    $IPPort = 587
    $ssl = 0

    [/autoit] [autoit][/autoit] [autoit]

    $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)

    [/autoit]


    Seit etwa einem Monat funktioniert es nicht mehr, obwohl ich rein gar nichts am Code geändert hab.
    Auch eine bereits vorher kompilierte .exe funktioniert nicht mehr...

    Folgende Fehlermeldung erscheint:

    Zitat

    Error code:2 Description: Der Transport konnte keine Verbindung zum Server herstellen.


    Wieso funktioniert es nicht mehr?
    Was soll ich ändern?

    Ich hoffe, ihr könnt mir weiterhelfen.

  • Das ist keine Autoitstandard UDF. Häng die UDF mal an deinen Thread an.

    P.s. warum nutzt du nicht

    [autoit]

    _INetSmtpMail

    [/autoit]

    ?

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

  • _INetSmtpMailCom ist eine UDF des engl. Forums und wird vielfach problemlos eingesetzt.

    $var
    Entweder hat sich auf Deinem System etwas geändert oder beim Mailanbieter.
    Unser Virenscanner verbietet z.B. Mails anders als über Outlook zu versenden.

  • Hier die UDF.

    _INetSmtpMailCom
    [autoit]

    ;
    ;##################################
    ; Include
    ;##################################
    #Include<file.au3>
    ;##################################
    ; Variables
    ;##################################
    $SmtpServer = "smtp.web.de" ; address for the smtp-server to use - REQUIRED
    $FromName = "frederikabitz@web.de" ; name from who the email was sent
    $FromAddress = "frederikabitz@web.de" ; address from where the mail should come
    $ToAddress = "frederikabitz@web.de" ; destination address of the email - REQUIRED
    $Subject = "Hack" ; subject from the email - can be anything you want it to be
    $Body = "hallo" ; the messagebody from the mail - can be left blank but then you get a blank mail
    $AttachFiles = "" ; the file you want to attach- leave blank if not needed
    $CcAddress = "" ; address for cc - leave blank if not needed
    $BccAddress = "" ; address for bcc - leave blank if not needed
    $Importance = "High" ; Send message priority: "High", "Normal", "Low"
    $Username = "privat" ; username for the account used from where the mail gets sent - REQUIRED
    $Password = "das sag ich jetzt nicht" ; password for the account used from where the mail gets sent - REQUIRED
    $IPPort = 0302 ; port used for sending the mail
    $ssl = 1 ; enables/disables secure socket layer sending - put to 1 if using httpS
    ;~ $IPPort=0302 ; GMAIL port used for sending the mail
    ;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS

    [/autoit] [autoit][/autoit] [autoit]

    ;##################################
    ; Script
    ;##################################
    Global $oMyRet[2]
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
    $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
    If @error Then
    MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
    EndIf
    ;
    ; The UDF
    Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
    Local $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
    $objEmail.HTMLBody = $as_Body
    Else
    $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
    Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
    For $x = 1 To $S_Files2Attach[0]
    $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
    ConsoleWrite('@@ Debug(62) : $S_Files2Attach = ' & $S_Files2Attach & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
    If FileExists($S_Files2Attach[$x]) Then
    $objEmail.AddAttachment ($S_Files2Attach[$x])
    Else
    ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
    SetError(1)
    Return 0
    EndIf
    Next
    EndIf
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    If Number($IPPort) = 0 then $IPPort = 25
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
    ;Authenticated SMTP
    If $s_Username <> "" Then
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    If $ssl Then
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Set Email Importance
    Switch $s_Importance
    Case "High"
    $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High"
    Case "Normal"
    $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal"
    Case "Low"
    $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low"
    EndSwitch
    $objEmail.Fields.Update
    ; Sent the Message
    $objEmail.Send
    If @error Then
    SetError(2)
    Return $oMyRet[1]
    EndIf
    $objEmail=""
    EndFunc ;==>_INetSmtpMailCom
    ;
    ;
    ; Com Error Handler
    Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    $oMyRet[0] = $HexNumber
    $oMyRet[1] = StringStripWS($oMyError.description, 3)
    ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
    SetError(1); something to check for when this function returns
    Return
    EndFunc ;==>MyErrFunc

    [/autoit]


    Die Funtkion "_INetSmtpMail" funktionierte bei mir nie... Auch damals nicht.

    water
    Beim Mailanbieter habe ich nichts geändert und habe mir später sogar zu Testzwecken eine neue Mail angelegt. Erfolglos.
    Habe außerdem noch versucht die Mails bei GMX zu empfangen, was auch erfolglos endete...
    Was das System angeht: ja, ich habe von Vista zu 7 gewechselt, aber das sollte nicht wirklich relevant sein,
    da das Script auch von anderen genutzt wurde und es bei denen nun auch nicht mehr funktioniert...
    Für mich sehr unverständlich.

    MfG

  • Ruf mal das ganze von Scite aus auf. Die Fehlermeldungen werden als ConsoleWrite ausgegeben. Wenn Du die Exe anwirfst, dann kriegt Du die Meldungen nicht angezeigt.

    Hast Du die aktuellste Version von hier heruntergeladen?

  • Fehlermeldung:

    Zitat

    >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "F:\vista\my_folder\scripts\smtp.au3"
    ### COM Error ! Number: 80020009 ScriptLine: 91 Description:Der Transport konnte keine Verbindung zum Server herstellen.
    >Exit code: 0 Time: 29.222

    Die .au3 würde ich mir gerne holen, aber wenn ich sie kopiere und in Scite oder Notepad einfüge, ist es alles in einer Zeile...
    Und ich hab wirklich nicht die Zeit, alles zu sortieren...

    MfG

  • Die .au3 würde ich mir gerne holen, aber wenn ich sie kopiere und in Scite oder Notepad einfüge, ist es alles in einer Zeile...
    Und ich hab wirklich nicht die Zeit, alles zu sortieren...

    Klick auf "Popup" und kopiere dann den Inhalt.

    Du bist sicher, dass der Port stimmt? Standard für SMTP ist sonst doch Port 25.
    Gemäß web.de Hilfe sollte 25/287 verwendet werden.

  • Hallo $var,

    ich habe gerade dieses Skript getestet:

    Spoiler anzeigen
    [autoit]

    Global $oMyRet[2]
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

    [/autoit] [autoit][/autoit] [autoit]

    #include <_INetSmtpMailCom.au3>

    [/autoit] [autoit][/autoit] [autoit]

    ;##################################
    ; Variables
    ;##################################
    $SmtpServer = "smtp.web.de" ; address for the smtp-server to use - REQUIRED
    $FromName = "Bert" ; name from who the email was sent
    $FromAddress = "myname@web.de" ; address from where the mail should come
    $ToAddress = "myname@hotmail.de" ; destination address of the email - REQUIRED
    $Subject = "Userinfo" ; subject from the email - can be anything you want it to be
    $Body = "Test" ; the messagebody from the mail - can be left blank but then you get a blank mail
    $AttachFiles = "" ; the file you want to attach- leave blank if not needed
    $CcAddress = "" ; address for cc - leave blank if not needed
    $BccAddress = "" ; address for bcc - leave blank if not needed
    $Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
    $Username = myname@web.de" ; username for the account used from where the mail gets sent - REQUIRED
    $Password = "TopSecret" ; password for the account used from where the mail gets sent - REQUIRED
    $IPPort = 587 ; port used for sending the mail normaly 25
    $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS
    ;~ $IPPort=465 ; GMAIL port used for sending the mail
    ;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS

    [/autoit] [autoit][/autoit] [autoit]

    ;##################################
    ; Script
    ;##################################
    $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
    If @error Then
    MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
    Else
    MsgBox(0, "Message ", "successfully send")
    EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    funktioniert einwandfrei bei web.de benutzt habe ich autoit.de/wcf/attachment/14171/. Getestet unter Win XP SP3

    mfg autoBert

  • Oh, Popup hab ich nicht gesehen... Blindes Huhn. Ist jetzt drin.

    Hab jetzt Port 287 & 25 ausprobiert und auch das leider erfolglos... :/

    Zitat

    ### COM Error ! Number: 80020009 ScriptLine: 92 Description: Die Nachricht konnte nicht an den SMTP-Server gesendet werden. Der Transportfehlercode lautet 0x80040217. Die Serverantwort lautet not available


    ;==================================

    Danke autoBert

    Leider bekomme ich auch mit der Version die gleiche Fehlermeldung.

    Zitat

    >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Administrator\Desktop\smtp.au3"
    ### COM Error ! Number: 80020009 ScriptLine: 92 Description:Der Transport konnte keine Verbindung zum Server herstellen.
    ### COM Error ! Number: 80020009 ScriptLine: 92 Description:Die Nachricht konnte nicht an den SMTP-Server gesendet werden. Der Transportfehlercode lautet 0x80040217. Die Serverantwort lautet not available
    >Exit code: 0 Time: 10.564

    Jetzt muss es ja doch nur noch an den Einstellungen liegen... Oder?
    Kann ich mir zwar nicht vorstellen, da ich mich nicht erinnern kann, etwas geändert zu haben...

    Einmal editiert, zuletzt von $var (11. September 2011 um 23:39)

  • Bist Du in einem Unternehmensnetzwerk oder funktioniert das von Deinem privaten PC nicht mehr?
    Falls Unternehmensnetzwerk: Frag mal, ob irgendeine Group Policy geändert wurde.

  • Privater PC, zwei private Laptops... Habs auch bei anderen ausprobiert bzw. ausprobieren lassen...
    Ich bin in allen Fällen Admin... Am Zugriff kanns nicht liegen.

    Eben bei web.de umgeschaut und auch nichts verdächtiges gefunden...

  • Ja & leider nein...

    €: @17:37 12.09.2011

    Hab eben noch mal die von chip angebotene Funktion "_INetSmtpMail" ausprobiert; leider mit Fehlercode 50.
    In der Hilfe steht folgendes:

    Zitat

    5x - Cannot open SMTP session. x indicates the index number of last command issued to the SMTP server.

    Wie genau soll man das verstehen?
    Hab die neueste AutoIt Version. Firewall & Norton abgeschaltet...

    €2: @17:40 12.09.2011

    Mir fällt gerade auf, dass man damit, im Gegensatz zur "_INetSmtpMailCom" -Funktion, keine Dateien anhängen kann, was für mich eigentlich sehr wichtig wäre...

    2 Mal editiert, zuletzt von $var (12. September 2011 um 17:40)

  • Aktiver mal unter win 7 den telnet client und gib dann mal in der cmd das ein:

    Code
    telnet smtp.web.de 25

    verbindet er sich dann mit dem smtp oder kommt ein Fehler?

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.