Email senden mit autoit mit spezieller funktion

  • hallo Com,

    ich sage zu Anfang das ich Anfänger in sachen Autoit bin. Hab mich schon etwas eingelesen aber einiges ist noch uklar für mich.

    Nun Ziel ist vom Script ist es eine Email zu versenden mit dem Inhalt der GUI. Die Betreffzeile soll generiert werden, die sich wie folgt zusammenstellen:

    StundeMinuteTagMonatJahr;Epfängernummer;Sendenummer;Username;Passwort;Option
    =
    120011052010;017777777777;016666666666;123456789;987456321;9


    Nun irgendwie ralle ich nicht wie ich es schaffe das es auch die email sendet. Ich bin mir sicher es liegt daran das ich nicht verstehe wie ich die funktion bearbeiten bzw. den senden Button dazu bringe das Script zum senden zu bewegen.

    Ich bin davon ausgegangen das dieser aufruf es bewirkt :

    Func Senden()
    _INetSmtpMailCom($SmtpServer, $FromAddress, $ToAddress, $Subject, $Body, $Importance, $Username, $Password, $IPPort, $ssl)
    EndFunc

    nun hier mein Script:

    Spoiler anzeigen

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_outfile=FSM-SMS-REMAINDER.exe
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_Change2CUI=y
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    ;~ #include <ubet.au3>

    #Region ### START Koda GUI section ### Form=\sms.kxf
    Global $Form1 = GUICreate("SMS", 500, 350, 320, 250)
    GUISetIcon("D:\004.ico")
    Global $Senden = GUICtrlCreateButton("Senden", 400, 200, 75, 25, 0)
    Global $Clear = GUICtrlCreateButton("Neue SMS", 400, 250, 75, 25, 0)
    Global $End = GUICtrlCreateButton("Beenden", 400, 300, 75, 25, 0)
    Global $hh = GUICtrlCreateInput("hh", 400, 24, 25, 25)
    Global $ss = GUICtrlCreateInput("ss", 440, 24, 25, 25)
    Global $TT = GUICtrlCreateInput("TT", 240, 25, 25, 25)
    Global $MM = GUICtrlCreateInput("MM", 280, 25, 25, 25)
    Global $JJJJ = GUICtrlCreateInput("JJJJ", 320, 25, 50, 25)
    Global $an = GUICtrlCreateInput("An", 25, 25, 150, 25)
    Global $von = GUICtrlCreateInput("Von", 25, 300, 150, 21)
    Global $Text = GUICtrlCreateInput("SMS-Text", 25, 80, 350, 200)
    Global $Sname = "XXXXX" ; Benutzername für SMS Dienst
    Global $Spw = "XYXYXYXYXYXY" ; Passwort für SMS Dienst
    Global $Opt = "c" ; Option ( c=ÜbrlangeSMS)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE

    Case $Senden ; senden
    Senden()


    Case $Clear ; löschen
    GUICtrlSetData($hh,"hh")
    GUICtrlSetData($ss,"ss")
    GUICtrlSetData($TT,"TT")
    GUICtrlSetData($MM,"MM")
    GUICtrlSetData($JJJJ,"JJJJ")
    GUICtrlSetData($an,"An")
    GUICtrlSetData($von,"Von")
    GUICtrlSetData($Text,"SMS-Text")


    Case $End ; beenden
    Quit()
    Exit

    EndSwitch
    WEnd


    $SmtpServer = "smtp.xxx.de" ;IP des Smtp-Server
    $FromAddress = "xxxxxxx@yyy.de" ;Absendemail
    $ToAddress = "xxx@yyy.de" ;Dienstemail
    $Subject = GUICtrlRead($hh)&";"&GUICtrlRead($ss)&";"&GUICtrlRead($TT)&";"&GUICtrlRead($MM)&";"&GUICtrlRead($JJJJ)&";"&GUICtrlRead($an)&";"&GUICtrlRead($von)&";"&GUICtrlRead($Sname)&";"&GUICtrlRead($Spw)&";"&GUICtrlRead($Opt) ;Betreffzeile
    $Body = GUICtrlRead($Text) ;Textinhalt
    $Importance = "Normal" ;Mailstatus / Low , Normal , High /
    $Username = "xxxxxx@yyy.de" ;Username Smtp-Server
    $Password = "XYXYXYX" ;Passwort Smtp-Server
    $IPPort = 25 ; bleibt so
    $ssl = 0 ; Ssl 0/1 = nein/ja


    Func Senden()
    _INetSmtpMailCom($SmtpServer, $FromAddress, $ToAddress, $Subject, $Body, $Importance, $Username, $Password, $IPPort, $ssl)
    EndFunc

    Func Quit()
    Exit
    EndFunc


    #Include<file.au3>
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

    Global $oMyRet[2]

    Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Username, $s_Password, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $IPPort=465, $ssl=1)
    $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])
    If FileExists($S_Files2Attach[$x]) Then
    $objEmail.AddAttachment ($S_Files2Attach[$x])
    Else
    $i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x]
    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
    $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
    ; Sent the Message
    $objEmail.Send
    if @error then
    SetError(2)
    return $oMyRet[1]
    EndIf
    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

    Einmal editiert, zuletzt von gorwales (9. Mai 2010 um 21:31)

  • Wie oft hatten wir das schon?
    Na ja, das müsste funktionieren:

    Spoiler anzeigen
    [autoit]

    ;
    ;##################################
    ; Include
    ;##################################
    #Include<file.au3>
    ;################################## ; Variables
    ;##################################
    $SmtpServer = "mail.server.com" ; address for the smtp-server to use - REQUIRED
    $FromName = "John.Doe" ; name from who the email was sent
    $FromAddress = "User@domain.com" ; address from where the mail should come
    $ToAddress = "user@domain.com" ; destination address of the email - REQUIRED
    $Subject = "Hello World!" ; subject from the email - can be anything you want it to be
    $Body = "This script is great! See attachment!" ; 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 = "" ; username for the account used from where the mail gets sent - REQUIRED
    $Password = "" ; password for the account used from where the mail gets sent - REQUIRED
    $IPPort = 25 ; port used for sending the mail
    $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
    ;##################################
    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") = 0
    $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]
    Spoiler anzeigen

    Grundkenntnisse in: C++, JavaScript
    Sehr gute Kenntnisse: PHP, JAVA, C und näturlich AutoIt


    Klaviatur, Anhang UDF, GDI+ Mühle

    Zitat

    "Wenn einen um 20h der Pizzadienst anruft und fragt, ob man's nur vergessen hat und ob man das gleiche
    möchte wie immer -- dann sollte man sein Bestellverhalten evtl überdenken"

  • Als Vorbild habe ich mir ja das Script genommen:

    Email senden mit _InetSmtpMailCom via Console / Gui

    Es hilft mir aber nicht wirklich weiter.

    Welche func muss man ind der GUI defenieren um zu sagen los sende nun?

    Weil das :

    Func Senden()
    _INetSmtpMailCom($SmtpServer, $FromAddress, $ToAddress, $Subject, $Body, $Importance, $Username, $Password, $IPPort, $ssl)
    EndFunc

    Bringt nur das :

    x.au3 (75) : ==> Variable used without being declared.:
    _INetSmtpMailCom($SmtpServer, $FromAddress, $ToAddress, $Subject, $Body, $Importance, $Username, $Password, $IPPort, $ssl)
    _INetSmtpMailCom(^ ERROR

  • Ganz einfach, du hast die Variablen nicht deklariert, wie der Fehler schon sagt...
    Nun ja, ich sags mal so, du solltest dich nach diesem Script nochmal die Grundlegenden Sachen von AutoIt anschauen
    Du musst die Variablem vor dem Aufrufen der Funktion deklarieren:

    Spoiler anzeigen
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_outfile=FSM-SMS-REMAINDER.exe
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_Change2CUI=y
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

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

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    ;~ #include <ubet.au3>
    $SmtpServer = "smtp.xxx.de" ;IP des Smtp-Server
    $FromAddress = "xxxxxxx@yyy.de" ;Absendemail
    $ToAddress = "xxx@yyy.de" ;Dienstemail
    $Subject = GUICtrlRead($hh)&";"&GUICtrlRead($ss)&";"&GUICtrlRead($TT)&";"&GUICtrlRead($MM)&";"&GUICtrlRead($JJJJ)&";"&GUICtrlRead($an)&";"&GUICtrlRead($von)&";"&GUICtrlRead($Sname)&";"&GUICtrlRead($Spw)&";"&GUICtrlRead($Opt) ;Betreffzeile
    $Body = GUICtrlRead($Text) ;Textinhalt
    $Importance = "Normal" ;Mailstatus / Low , Normal , High /
    $Username = "xxxxxx@yyy.de" ;Username Smtp-Server
    $Password = "XYXYXYX" ;Passwort Smtp-Server
    $IPPort = 25 ; bleibt so
    $ssl = 0 ; Ssl 0/1 = nein/ja

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

    #Region ### START Koda GUI section ### Form=\sms.kxf
    Global $Form1 = GUICreate("SMS", 500, 350, 320, 250)
    GUISetIcon("D:\004.ico")
    Global $Senden = GUICtrlCreateButton("Senden", 400, 200, 75, 25, 0)
    Global $Clear = GUICtrlCreateButton("Neue SMS", 400, 250, 75, 25, 0)
    Global $End = GUICtrlCreateButton("Beenden", 400, 300, 75, 25, 0)
    Global $hh = GUICtrlCreateInput("hh", 400, 24, 25, 25)
    Global $ss = GUICtrlCreateInput("ss", 440, 24, 25, 25)
    Global $TT = GUICtrlCreateInput("TT", 240, 25, 25, 25)
    Global $MM = GUICtrlCreateInput("MM", 280, 25, 25, 25)
    Global $JJJJ = GUICtrlCreateInput("JJJJ", 320, 25, 50, 25)
    Global $an = GUICtrlCreateInput("An", 25, 25, 150, 25)
    Global $von = GUICtrlCreateInput("Von", 25, 300, 150, 21)
    Global $Text = GUICtrlCreateInput("SMS-Text", 25, 80, 350, 200)
    Global $Sname = "XXXXX" ; Benutzername für SMS Dienst
    Global $Spw = "XYXYXYXYXYXY" ; Passwort für SMS Dienst
    Global $Opt = "c" ; Option ( c=ÜbrlangeSMS)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE

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

    Case $Senden ; senden
    Senden()

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

    Case $Clear ; löschen
    GUICtrlSetData($hh,"hh")
    GUICtrlSetData($ss,"ss")
    GUICtrlSetData($TT,"TT")
    GUICtrlSetData($MM,"MM")
    GUICtrlSetData($JJJJ,"JJJJ")
    GUICtrlSetData($an,"An")
    GUICtrlSetData($von,"Von")
    GUICtrlSetData($Text,"SMS-Text")

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

    Case $End ; beenden
    Quit()
    Exit

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

    EndSwitch
    WEnd

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

    Func Senden()
    _INetSmtpMailCom($SmtpServer, $FromAddress, $ToAddress, $Subject, $Body, $Importance, $Username, $Password, $IPPort, $ssl)
    EndFunc

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

    Func Quit()
    Exit
    EndFunc

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

    #Include<file.au3>
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

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

    Global $oMyRet[2]

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

    Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Username, $s_Password, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $IPPort=465, $ssl=1)
    $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])
    If FileExists($S_Files2Attach[$x]) Then
    $objEmail.AddAttachment ($S_Files2Attach[$x])
    Else
    $i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x]
    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
    $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
    ; Sent the Message
    $objEmail.Send
    if @error then
    SetError(2)
    return $oMyRet[1]
    EndIf
    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]
    Spoiler anzeigen

    Grundkenntnisse in: C++, JavaScript
    Sehr gute Kenntnisse: PHP, JAVA, C und näturlich AutoIt


    Klaviatur, Anhang UDF, GDI+ Mühle

    Zitat

    "Wenn einen um 20h der Pizzadienst anruft und fragt, ob man's nur vergessen hat und ob man das gleiche
    möchte wie immer -- dann sollte man sein Bestellverhalten evtl überdenken"

  • Ich will ja jetzt nicht Begriffsstutzig wirken aber es kommen nun diese fehlermeldungen:

    t.au3"
    AutoIt3 Syntax Checker v1.54.8 Copyright (c) Tylo 2007

    C:\Documents and Settings\Administrator\My Documents\Downloads\SMS\jtzt.au3(15,27) : WARNING: $hh: possibly used before declaration.
    $Subject = GUICtrlRead($hh)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Documents and Settings\Administrator\My Documents\Downloads\SMS\jtzt.au3(15,48) : WARNING: $ss: possibly used before declaration.
    $Subject = GUICtrlRead($hh)&";"&GUICtrlRead($ss)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Documents and Settings\Administrator\My Documents\Downloads\SMS\jtzt.au3(15,69) : WARNING: $TT: possibly used before declaration.
    $Subject = GUICtrlRead($hh)&";"&GUICtrlRead($ss)&";"&GUICtrlRead($TT)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Documents and Settings\Administrator\My Documents\Downloads\SMS\jtzt.au3(15,90) : WARNING: $MM: possibly used before declaration.
    $Subject = GUICtrlRead($hh)&";"&GUICtrlRead($ss)&";"&GUICtrlRead($TT)&";"&GUICtrlRead($MM)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Documents and Settings\Administrator\My Documents\Downloads\SMS\jtzt.au3(15,113) : WARNING: $JJJJ: possibly used before declaration.
    $Subject = GUICtrlRead($hh)&";"&GUICtrlRead($ss)&";"&GUICtrlRead($TT)&";"&GUICtrlRead($MM)&";"&GUICtrlRead($JJJJ)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Documents and Settings\Administrator\My Documents\Downloads\SMS\jtzt.au3(15,134) : WARNING: $an: possibly used before declaration.
    $Subject = GUICtrlRead($hh)&";"&GUICtrlRead($ss)&";"&GUICtrlRead($TT)&";"&GUICtrlRead($MM)&";"&GUICtrlRead($JJJJ)&";"&GUICtrlRead($an)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Documents and Settings\Administrator\My Documents\Downloads\SMS\jtzt.au3(15,156) : WARNING: $von: possibly used before declaration.
    $Subject = GUICtrlRead($hh)&";"&GUICtrlRead($ss)&";"&GUICtrlRead($TT)&";"&GUICtrlRead($MM)&";"&GUICtrlRead($JJJJ)&";"&GUICtrlRead($an)&";"&GUICtrlRead($von)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Documents and Settings\Administrator\My Documents\Downloads\SMS\jtzt.au3(15,180) : WARNING: $Sname: possibly used before declaration.
    $Subject = GUICtrlRead($hh)&";"&GUICtrlRead($ss)&";"&GUICtrlRead($TT)&";"&GUICtrlRead($MM)&";"&GUICtrlRead($JJJJ)&";"&GUICtrlRead($an)&";"&GUICtrlRead($von)&";"&GUICtrlRead($Sname)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Documents and Settings\Administrator\My Documents\Downloads\SMS\jtzt.au3(15,202) : WARNING: $Spw: possibly used before declaration.
    $Subject = GUICtrlRead($hh)&";"&GUICtrlRead($ss)&";"&GUICtrlRead($TT)&";"&GUICtrlRead($MM)&";"&GUICtrlRead($JJJJ)&";"&GUICtrlRead($an)&";"&GUICtrlRead($von)&";"&GUICtrlRead($Sname)&";"&GUICtrlRead($Spw)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Documents and Settings\Administrator\My Documents\Downloads\SMS\jtzt.au3(15,224) : WARNING: $Opt: possibly used before declaration.
    $Subject = GUICtrlRead($hh)&";"&GUICtrlRead($ss)&";"&GUICtrlRead($TT)&";"&GUICtrlRead($MM)&";"&GUICtrlRead($JJJJ)&";"&GUICtrlRead($an)&";"&GUICtrlRead($von)&";"&GUICtrlRead($Sname)&";"&GUICtrlRead($Spw)&";"&GUICtrlRead($Opt)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Documents and Settings\Administrator\My Documents\Downloads\SMS\jtzt.au3(16,26) : WARNING: $Text: possibly used before declaration.
    $Body = GUICtrlRead($Text)
    ~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Documents and Settings\Administrator\My Documents\Downloads\SMS\jtzt.au3 - 0 error(s), 11 warning(s)
    >Exit code: 1 Time: 0.309

    Und soweit ich es sehe sind das alles Infos die das Script aus der GUI ziehen soll?? Oder sthe ich jetzt völlig auf dem Schlauch?

    So kommt keine Fehlermeldung:

    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_outfile=FSM-SMS-REMAINDER.exe
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_Change2CUI=y
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

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

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    ;~ $SmtpServer = "smtp.xxx.de" ;IP des Smtp-Server
    ;~ $FromAddress = "xxxxxxx@yyy.de" ;Absendemail
    ;~ $ToAddress = "xxx@yyy.de" ;Dienstemail
    ;~ $Subject = GUICtrlRead($hh)&";"&GUICtrlRead($ss)&";"&GUICtrlRead($TT)&";"&GUICtrlRead($MM)&";"&GUICtrlRead($JJJJ)&";"&GUICtrlRead($an)&";"&GUICtrlRead($von)&";"&GUICtrlRead($Sname)&";"&GUICtrlRead($Spw)&";"&GUICtrlRead($Opt) ;Betreffzeile
    ;~ $Body = GUICtrlRead($Text) ;Textinhalt
    ;~ $Importance = "Normal" ;Mailstatus / Low , Normal , High /
    ;~ $Username = "xxxxxx@yyy.de" ;Username Smtp-Server
    ;~ $Password = "XYXYXYX" ;Passwort Smtp-Server
    ;~ $IPPort = 25 ; bleibt so
    ;~ $ssl = 0 ; Ssl 0/1 = nein/ja

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

    #Region ### START Koda GUI section ### Form=\sms.kxf
    Global $Form1 = GUICreate("SMS", 500, 350, 320, 250)
    GUISetIcon("D:\004.ico")
    Global $Senden = GUICtrlCreateButton("Senden", 400, 200, 75, 25, 0)
    Global $Clear = GUICtrlCreateButton("Neue SMS", 400, 250, 75, 25, 0)
    Global $End = GUICtrlCreateButton("Beenden", 400, 300, 75, 25, 0)
    Global $hh = GUICtrlCreateInput("hh", 400, 24, 25, 25)
    Global $ss = GUICtrlCreateInput("ss", 440, 24, 25, 25)
    Global $TT = GUICtrlCreateInput("TT", 240, 25, 25, 25)
    Global $MM = GUICtrlCreateInput("MM", 280, 25, 25, 25)
    Global $JJJJ = GUICtrlCreateInput("JJJJ", 320, 25, 50, 25)
    Global $an = GUICtrlCreateInput("An", 25, 25, 150, 25)
    Global $von = GUICtrlCreateInput("Von", 25, 300, 150, 21)
    Global $Text = GUICtrlCreateInput("SMS-Text", 25, 80, 350, 200)
    Global $Sname = "XXXXX" ; Benutzername für SMS Dienst
    Global $Spw = "XYXYXYXYXYXY" ; Passwort für SMS Dienst
    Global $Opt = "c" ; Option ( c=ÜbrlangeSMS)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    $SmtpServer = "smtp.xxx.de" ;IP des Smtp-Server
    $FromAddress = "xxxxxxx@yyy.de" ;Absendemail
    $ToAddress = "xxx@yyy.de" ;Dienstemail
    $Subject = GUICtrlRead($hh)&";"&GUICtrlRead($ss)&";"&GUICtrlRead($TT)&";"&GUICtrlRead($MM)&";"&GUICtrlRead($JJJJ)&";"&GUICtrlRead($an)&";"&GUICtrlRead($von)&";"&GUICtrlRead($Sname)&";"&GUICtrlRead($Spw)&";"&GUICtrlRead($Opt) ;Betreffzeile
    $Body = GUICtrlRead($Text) ;Textinhalt
    $Importance = "Normal" ;Mailstatus / Low , Normal , High /
    $Username = "xxxxxx@yyy.de" ;Username Smtp-Server
    $Password = "XYXYXYX" ;Passwort Smtp-Server
    $IPPort = 25 ; bleibt so
    $ssl = 0 ; Ssl 0/1 = nein/ja

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE

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

    Case $Senden ; senden
    Senden()

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

    Case $Clear ; löschen
    GUICtrlSetData($hh,"hh")
    GUICtrlSetData($ss,"ss")
    GUICtrlSetData($TT,"TT")
    GUICtrlSetData($MM,"MM")
    GUICtrlSetData($JJJJ,"JJJJ")
    GUICtrlSetData($an,"An")
    GUICtrlSetData($von,"Von")
    GUICtrlSetData($Text,"SMS-Text")

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

    Case $End ; beenden
    Quit()
    Exit

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

    EndSwitch
    WEnd

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

    Func Senden()
    _INetSmtpMailCom($SmtpServer, $FromAddress, $ToAddress, $Subject, $Body, $Importance, $Username, $Password, $IPPort, $ssl)
    EndFunc

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

    Func Quit()
    Exit
    EndFunc

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

    #Include<file.au3>
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

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

    Global $oMyRet[2]

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

    Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Username, $s_Password, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $IPPort=465, $ssl=1)
    $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])
    If FileExists($S_Files2Attach[$x]) Then
    $objEmail.AddAttachment ($S_Files2Attach[$x])
    Else
    $i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x]
    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
    $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
    ; Sent the Message
    $objEmail.Send
    if @error then
    SetError(2)
    return $oMyRet[1]
    EndIf
    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]
  • Oh sorry, dann machs so:

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_outfile=FSM-SMS-REMAINDER.exe
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_Change2CUI=y
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

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

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    ;~ #include <ubet.au3>

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

    #Region ### START Koda GUI section ### Form=\sms.kxf
    Global $Form1 = GUICreate("SMS", 500, 350, 320, 250)
    GUISetIcon("D:\004.ico")
    Global $Senden = GUICtrlCreateButton("Senden", 400, 200, 75, 25, 0)
    Global $Clear = GUICtrlCreateButton("Neue SMS", 400, 250, 75, 25, 0)
    Global $End = GUICtrlCreateButton("Beenden", 400, 300, 75, 25, 0)
    Global $hh = GUICtrlCreateInput("hh", 400, 24, 25, 25)
    Global $ss = GUICtrlCreateInput("ss", 440, 24, 25, 25)
    Global $TT = GUICtrlCreateInput("TT", 240, 25, 25, 25)
    Global $MM = GUICtrlCreateInput("MM", 280, 25, 25, 25)
    Global $JJJJ = GUICtrlCreateInput("JJJJ", 320, 25, 50, 25)
    Global $an = GUICtrlCreateInput("An", 25, 25, 150, 25)
    Global $von = GUICtrlCreateInput("Von", 25, 300, 150, 21)
    Global $Text = GUICtrlCreateInput("SMS-Text", 25, 80, 350, 200)
    Global $Sname = "XXXXX" ; Benutzername für SMS Dienst
    Global $Spw = "XYXYXYXYXYXY" ; Passwort für SMS Dienst
    Global $Opt = "c" ; Option ( c=ÜbrlangeSMS)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE

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

    Case $Senden ; senden
    $SmtpServer = "smtp.xxx.de" ;IP des Smtp-Server
    $FromAddress = "xxxxxxx@yyy.de" ;Absendemail
    $ToAddress = "xxx@yyy.de" ;Dienstemail
    $Subject = GUICtrlRead($hh)&";"&GUICtrlRead($ss)&";"&GUICtrlRead($TT)&";"&GUICtrlRead($MM)&";"&GUICtrlRead($JJJJ)&";"&GUICtrlRead($an)&";"&GUICtrlRead($von)&";"&GUICtrlRead($Sname)&";"&GUICtrlRead($Spw)&";"&GUICtrlRead($Opt) ;Betreffzeile
    $Body = GUICtrlRead($Text) ;Textinhalt
    $Importance = "Normal" ;Mailstatus / Low , Normal , High /
    $Username = "xxxxxx@yyy.de" ;Username Smtp-Server
    $Password = "XYXYXYX" ;Passwort Smtp-Server
    $IPPort = 25 ; bleibt so
    $ssl = 0 ; Ssl 0/1 = nein/ja
    Senden()

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

    Case $Clear ; löschen
    GUICtrlSetData($hh,"hh")
    GUICtrlSetData($ss,"ss")
    GUICtrlSetData($TT,"TT")
    GUICtrlSetData($MM,"MM")
    GUICtrlSetData($JJJJ,"JJJJ")
    GUICtrlSetData($an,"An")
    GUICtrlSetData($von,"Von")
    GUICtrlSetData($Text,"SMS-Text")

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

    Case $End ; beenden
    Quit()
    Exit

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

    EndSwitch
    WEnd

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

    Func Senden()
    _INetSmtpMailCom($SmtpServer, $FromAddress, $ToAddress, $Subject, $Body, $Importance, $Username, $Password, $IPPort, $ssl)
    EndFunc

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

    Func Quit()
    Exit
    EndFunc

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

    #Include<file.au3>
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

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

    Global $oMyRet[2]

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

    Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Username, $s_Password, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $IPPort=465, $ssl=1)
    $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])
    If FileExists($S_Files2Attach[$x]) Then
    $objEmail.AddAttachment ($S_Files2Attach[$x])
    Else
    $i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x]
    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
    $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
    ; Sent the Message
    $objEmail.Send
    if @error then
    SetError(2)
    return $oMyRet[1]
    EndIf
    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]
    Spoiler anzeigen

    Grundkenntnisse in: C++, JavaScript
    Sehr gute Kenntnisse: PHP, JAVA, C und näturlich AutoIt


    Klaviatur, Anhang UDF, GDI+ Mühle

    Zitat

    "Wenn einen um 20h der Pizzadienst anruft und fragt, ob man's nur vergessen hat und ob man das gleiche
    möchte wie immer -- dann sollte man sein Bestellverhalten evtl überdenken"

  • Ok erstmal viel Dank auch wenn ich damit ein oft gestelltes Problem angesprochen habe.

    So jetzt habe ich aber dennoch ein Frage.

    Wie bringe ich das script dazu eine art LOGATEI zu verfassen? Also in der Datei soll stehen Wann welcher Betreff mit welchem Inhalt abgesendet worden ist.

    Soweit ich weiss soll der Aufruf dafür sorgen:

    IniWrite

    Aber wie bringe ich die sendezeit rein?

    Aber mein Aufruf

    IniWrite ("Log.ini",$SmtpServer,$FromAddress,$ToAddress,$Subject,$Body,$Importance,$Username,$Password,$IPPort,$ssl)

    bringt es nicht.

    Hab meinen Denkfehler selber gefunden. So gehts:

    $read = GUICtrlRead($SmtpServer)
    IniWrite("Log.ini","Server","server",$SmtpServer)

    2 Mal editiert, zuletzt von gorwales (9. Mai 2010 um 21:23)

  • Schau dir mal folgende Funktion an:

    Spoiler anzeigen
    [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    #include <file.au3>
    ;
    _FileWriteLog(@ScriptDir & "\Mein.log", "Text 1" & "Text2")

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