Empfänger auswählen und Standard-E-Mail verschicken?

  • Hallo cartan12,

    teste doch einmal dieses Skript:

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

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

    AutoIt Version: 3.2.12.1
    Author: myName

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

    Script Function:
    Template AutoIt script.

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

    #ce ----------------------------------------------------------------------------

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

    ; Script Start - Add your code below here
    ;
    ;##################################
    ; Include
    ;##################################
    #Include<file.au3>
    ;##################################
    ; Variables
    ;##################################
    $SmtpServer = "MailServer" ; address for the smtp-server to use - REQUIRED
    $FromName = "Name" ; name from who the email was sent
    $FromAddress = "your@Email.Address.com" ; address from where the mail should come
    $ToAddress = "your@Email.Address.com" ; destination address of the email - REQUIRED
    $Subject = "Userinfo" ; subject from the email - can be anything you want it to be
    $Body = "" ; 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 = "CCadress1@test.com" ; address for cc - leave blank if not needed
    $BccAddress = "BCCadress1@test.com" ; 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") = 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]

    mfg (Auto)Bert

  • Danke AutoBert! Ich schlage mich schon seit Wochen mit diesem Problem rum, und endlich ist es weg :D

    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"

  • 0 problemo ;)

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <Inet.au3>
    Global $section
    $section = IniReadSection("Email.ini", "Emails")
    Dim $Checkbox[$Section[0][0]+1]

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

    $Form1 = GUICreate("Email Prog", 400, Round($section[0][0]/2)*30+290)
    For $i = 1 To $Section[0][0]
    $Checkbox[$i] = GUICtrlCreateCheckbox($Section[$i][0], 205 - Mod($i, 2)*200, 5 + (Round($i/2) - 1)*30, 190, 25)
    Next
    $label1 = GUICtrlCreateLabel("_________________________________________________________________", 5, (Mod($section[0][0], 2) +Round($i/2) - 1)*30 - 5, 390, 25)
    $label2 = GUICtrlCreateLabel("Betreff:", 5, 13 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Input1 = GUICtrlCreateInput(IniRead("Email.ini", "Standards", "Betreff", ""), 5, 35 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    $label2 = GUICtrlCreateLabel("Nachrichttext:", 5, 73 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Edit1 = GUICtrlCreateEdit(StringReplace(IniRead("Email.ini", "Standards", "Nachricht", ""), " |@CRLF| ", @CRLF) , 5, 95 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 100)
    $label3 = GUICtrlCreateLabel("Empfänger:", 5, 208 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Input2 = GUICtrlCreateInput("", 5, 230 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    $Button1 = GUICtrlCreateButton("Standards speichern", 30, 260 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 120, 25)
    $Button2 = GUICtrlCreateButton("Email senden", 230, 260 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 120, 25)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Checkbox[1] To $Checkbox[$Section[0][0]]
    $emails = ""
    For $i = 1 To $Section[0][0]
    If BitAnd(GUICtrlRead($Checkbox[$i]), $GUI_CHECKED) Then
    $emails &= $Section[$i][1] & "; "
    EndIf
    Next
    Guictrlsetdata($Input2, $emails)
    Case $Button1
    IniWrite("Email.ini", "Standards", "Betreff", GUICtrlRead($Input1))
    IniWrite("Email.ini", "Standards", "Nachricht", StringReplace(GUICtrlRead($Edit1), @CRLF, " |@CRLF| "))
    Case $Button2
    _INetMail(GUICtrlRead($Input2), GUICtrlRead($Input1), GUICtrlRead($Edit1))
    EndSwitch
    WEnd

    [/autoit]
  • Hallo Schnitzel,

    funktioniert wie gewollt :):thumbup:

    zwei Fragen noch:

    1. Lässt sich die eingestellte Outlook-Signatur automatisch am Ende der Nachricht einfügen?
    2. Zur Zeit muss ich Outlook auf "Senden" klicken, damit die e-Mail verschickt wird. Gibt es die Möglichkeit dies direkt zu verschicken?

    Vielen Dank :thumbup:

    Beste Grüße,
    Dino

  • Button 2 so wie hier, dann klappt es. Ist nur die Farge, ob es mit jedem Outlook so arbeitert.

    Spoiler anzeigen
    [autoit]


    Case $Button2
    _INetMail(GUICtrlRead($Input2), GUICtrlRead($Input1), GUICtrlRead($Edit1))
    sleep(500)
    Send("!s")

    [/autoit]

    Lieben Gruß,
    Alina

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Geheime Information: ;)
    OuBVU5ebLhHu5QvlnAyQB4A7SzBrvWulwL7RLl2BdH5tI6sIYspeMKeXMSXl

  • Hallo Alina,

    es funktioniert prima. Hast du noch die Lösung auf meine erste Frage:
    1. Lässt sich die eingestellte Outlook-Signatur automatisch am Ende der Nachricht einfügen?

    Wenn ich in Outlook neue Nachricht schreibe, wird die Signatur automatisch eingefügt. Das wäre auch gut, wenn dies auch mit diese Script funktionieren würde.

    Viele Grüße,
    Dino

  • Spontan würde ich es so lösen:

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>
    #include <Inet.au3>
    Global $section
    ; kann man auch via INI-Datei einlesen mit IniRead
    $signatur = "Ich bin die erste Zeile der Signatur"
    $signatur2 = "Ich bin die zweite Zeile der Signatur"
    $signatur3 = "Ich bin die dritte Zeile der Signatur"
    $signatur4 = "Ich bin die vierte Zeile der Signatur"

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

    $section = IniReadSection("Email.ini", "Emails")
    Dim $Checkbox[$Section[0][0]+1]

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

    $Form1 = GUICreate("Email Prog", 400, Round($section[0][0]/2)*30+290)
    For $i = 1 To $Section[0][0]
    $Checkbox[$i] = GUICtrlCreateCheckbox($Section[$i][0], 205 - Mod($i, 2)*200, 5 + (Round($i/2) - 1)*30, 190, 25)
    Next
    $label1 = GUICtrlCreateLabel("_________________________________________________________________", 5, (Mod($section[0][0], 2) +Round($i/2) - 1)*30 - 5, 390, 25)
    $label2 = GUICtrlCreateLabel("Betreff:", 5, 13 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Input1 = GUICtrlCreateInput(IniRead("Email.ini", "Standards", "Betreff", ""), 5, 35 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    $label2 = GUICtrlCreateLabel("Nachrichttext:", 5, 73 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Edit1 = GUICtrlCreateEdit(StringReplace(IniRead("Email.ini", "Standards", "Nachricht", ""), " |@CRLF| ", @CRLF) , 5, 95 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 100)
    $label3 = GUICtrlCreateLabel("Empfänger:", 5, 208 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Input2 = GUICtrlCreateInput("", 5, 230 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    $Button1 = GUICtrlCreateButton("Standards speichern", 30, 260 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 120, 25)
    $Button2 = GUICtrlCreateButton("Email senden", 230, 260 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 120, 25)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Checkbox[1] To $Checkbox[$Section[0][0]]
    $emails = ""
    For $i = 1 To $Section[0][0]
    If BitAnd(GUICtrlRead($Checkbox[$i]), $GUI_CHECKED) Then
    $emails &= $Section[$i][1] & "; "
    EndIf
    Next
    Guictrlsetdata($Input2, $emails)
    Case $Button1
    IniWrite("Email.ini", "Standards", "Betreff", GUICtrlRead($Input1))
    IniWrite("Email.ini", "Standards", "Nachricht", StringReplace(GUICtrlRead($Edit1), @CRLF, " |@CRLF| "))
    Case $Button2
    _INetMail(GUICtrlRead($Input2), GUICtrlRead($Input1), GUICtrlRead($Edit1) & @CRLF & @CRLF & $signatur &@CRLF & $signatur2 & @CRLF & $signatur3 & @CRLF & $signatur4)
    sleep(500)
    Send("!s")

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

    EndSwitch
    WEnd

    [/autoit]

    Lieben Gruß,
    Alina

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Geheime Information: ;)
    OuBVU5ebLhHu5QvlnAyQB4A7SzBrvWulwL7RLl2BdH5tI6sIYspeMKeXMSXl

  • habs dir mal für de standart signaturen von outlook gebastelt.

    Spoiler anzeigen
    [autoit]

    #include <ComboConstants.au3>
    #include <File.au3>
    #include <GUIConstantsEx.au3>
    #include <Inet.au3>
    Global $section, $combodata
    $section = IniReadSection("Email.ini", "Emails")
    Dim $Checkbox[$Section[0][0]+1]

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

    $Form1 = GUICreate("Email Prog", 400, Round($section[0][0]/2)*30+290)
    For $i = 1 To $Section[0][0]
    $Checkbox[$i] = GUICtrlCreateCheckbox($Section[$i][0], 205 - Mod($i, 2)*200, 5 + (Round($i/2) - 1)*30, 190, 25)
    Next
    $label1 = GUICtrlCreateLabel("_________________________________________________________________", 5, (Mod($section[0][0], 2) +Round($i/2) - 1)*30 - 5, 390, 25)
    $label2 = GUICtrlCreateLabel("Betreff:", 5, 13 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Input1 = GUICtrlCreateInput(IniRead("Email.ini", "Standards", "Betreff", ""), 5, 35 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    $label2 = GUICtrlCreateLabel("Nachrichttext:", 5, 73 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Edit1 = GUICtrlCreateEdit(StringReplace(IniRead("Email.ini", "Standards", "Nachricht", ""), " |@CRLF| ", @CRLF) , 5, 95 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 100)
    $label3 = GUICtrlCreateLabel("Empfänger:", 5, 208 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Input2 = GUICtrlCreateInput("", 5, 230 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    $Button1 = GUICtrlCreateButton("Standards speichern", 5, 260 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 120, 25)
    $Button2 = GUICtrlCreateButton("Email senden", 135, 260 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 130, 25)
    $Combo1 = GUICtrlCreateCombo("", 275, 261 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 120, 30, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUISetState(@SW_SHOW)

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

    $signaturs = _FileListToArray(@AppDataDir & "\Microsoft\Signatures", "*.txt", 1)
    If IsArray($signaturs) Then
    For $i = 1 To $signaturs[0] Step 1
    $combodata &= $signaturs[$i] & "|"
    Next
    GUICtrlSetData($Combo1, " |" &$combodata)
    Else
    GUICtrlSetState($Combo1, $GUI_DISABLE)
    EndIf

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Checkbox[1] To $Checkbox[$Section[0][0]]
    $emails = ""
    For $i = 1 To $Section[0][0]
    If BitAnd(GUICtrlRead($Checkbox[$i]), $GUI_CHECKED) Then
    $emails &= $Section[$i][1] & "; "
    EndIf
    Next
    Guictrlsetdata($Input2, $emails)
    Case $Button1
    IniWrite("Email.ini", "Standards", "Betreff", GUICtrlRead($Input1))
    IniWrite("Email.ini", "Standards", "Nachricht", StringReplace(GUICtrlRead($Edit1), @CRLF, " |@CRLF| "))
    Case $Button2
    If FileExists(@AppDataDir & "\Microsoft\Signatures\" & GUICtrlRead($Combo1)) Then
    $signatur = @CRLF & @CRLF & FileRead(@AppDataDir & "\Microsoft\Signatures\" & GUICtrlRead($Combo1))
    Else
    $signatur = ""
    EndIf
    _INetMail(GUICtrlRead($Input2), GUICtrlRead($Input1), GUICtrlRead($Edit1) & $signatur)
    EndSwitch
    WEnd

    [/autoit]
  • Hallo zusammen,

    bei mir läuft es noch nicht ganz ^^

    1. Wenn in der Signatur das Zeichen & drin ist, dann wird die Signatur nur bis dahin eingefügt / dargestellt.
    Da gibt es sicherlich ein Trick dies noch zu lösen.

    2. Kann man die Signatur (unten rechts) automatisch auf erste Signatur mit Name einstellen. Beim Starten der Script ist die Signatur auf keine (leer) eingestellt.
    [Blockierte Grafik: http://imgbox.de/users/public/images/a39898x114.jpg]

    3. Könntest du mir bitte noch die Koda-Datei hochladen.

    Danke!!!!

    Viele Grüße,
    Dino

  • 2.

    Spoiler anzeigen
    [autoit]

    #include <ComboConstants.au3>
    #include <File.au3>
    #include <GUIConstantsEx.au3>
    #include <Inet.au3>
    Global $section, $combodata
    $section = IniReadSection("Email.ini", "Emails")
    Dim $Checkbox[$Section[0][0]+1]

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

    $Form1 = GUICreate("Email Prog", 400, Round($section[0][0]/2)*30+290)
    For $i = 1 To $Section[0][0]
    $Checkbox[$i] = GUICtrlCreateCheckbox($Section[$i][0], 205 - Mod($i, 2)*200, 5 + (Round($i/2) - 1)*30, 190, 25)
    Next
    $label1 = GUICtrlCreateLabel("_________________________________________________________________", 5, (Mod($section[0][0], 2) +Round($i/2) - 1)*30 - 5, 390, 25)
    $label2 = GUICtrlCreateLabel("Betreff:", 5, 13 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Input1 = GUICtrlCreateInput(IniRead("Email.ini", "Standards", "Betreff", ""), 5, 35 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    $label2 = GUICtrlCreateLabel("Nachrichttext:", 5, 73 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Edit1 = GUICtrlCreateEdit(StringReplace(IniRead("Email.ini", "Standards", "Nachricht", ""), " |@CRLF| ", @CRLF) , 5, 95 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 100)
    $label3 = GUICtrlCreateLabel("Empfänger:", 5, 208 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Input2 = GUICtrlCreateInput("", 5, 230 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    $Button1 = GUICtrlCreateButton("Standards speichern", 5, 260 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 120, 25)
    $Button2 = GUICtrlCreateButton("Email senden", 135, 260 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 130, 25)
    $Combo1 = GUICtrlCreateCombo("", 275, 261 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 120, 30, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUISetState(@SW_SHOW)

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

    $signaturs = _FileListToArray(@AppDataDir & "\Microsoft\Signatures", "*.txt", 1)
    If IsArray($signaturs) Then
    For $i = 1 To $signaturs[0] Step 1
    $combodata &= $signaturs[$i] & "|"
    Next
    GUICtrlSetData($Combo1, " |" &$combodata, $signaturs[$i - 1])
    Else
    GUICtrlSetState($Combo1, $GUI_DISABLE)
    EndIf

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Checkbox[1] To $Checkbox[$Section[0][0]]
    $emails = ""
    For $i = 1 To $Section[0][0]
    If BitAnd(GUICtrlRead($Checkbox[$i]), $GUI_CHECKED) Then
    $emails &= $Section[$i][1] & "; "
    EndIf
    Next
    Guictrlsetdata($Input2, $emails)
    Case $Button1
    IniWrite("Email.ini", "Standards", "Betreff", GUICtrlRead($Input1))
    IniWrite("Email.ini", "Standards", "Nachricht", StringReplace(GUICtrlRead($Edit1), @CRLF, " |@CRLF| "))
    Case $Button2
    If FileExists(@AppDataDir & "\Microsoft\Signatures\" & GUICtrlRead($Combo1)) Then
    $signatur = FileRead(@AppDataDir & "\Microsoft\Signatures\" & GUICtrlRead($Combo1))
    Else
    $signatur = ""
    EndIf
    _INetMail(GUICtrlRead($Input2), GUICtrlRead($Input1), GUICtrlRead($Edit1) & @CRLF & @CRLF & $signatur)
    EndSwitch
    WEnd

    [/autoit]


    3. koda datei gibts keine :D
    das ganze is per hand geschrieben, weil die größe und position usw ja von der ini abhängt

    zu 1. such ich dir gleich noch was. ich wunder mich egtl nur das es so nicht funktioniert...

  • ok problem ist folgendes: _InetMail startet outlook über parameter. das & zeichen lässt sich leider nict mit einbauen, da es von outlook irgendwie verarbeitet wird...
    also entweder auf das & verzichten oder ein workaround mit controlsettext oder ähnlichen basteln.
    ich bin ab morgen leider wieder unterwegs und hab wenig zeit dafür. aber wenn du lieb frägst findet sich bestimmt jemand ;)

  • Hallo Leute,

    Dies ist noch nicht gelöst:
    Wenn in der Signatur das Zeichen & drin ist, dann wird die Signatur nur bis dahin eingefügt / dargestellt.
    Da gibt es sicherlich ein Trick dies noch zu lösen.

    Spoiler anzeigen
    [autoit]

    #include <ComboConstants.au3>
    #include <File.au3>
    #include <GUIConstantsEx.au3>
    #include <Inet.au3>
    Global $section, $combodata
    $section = IniReadSection("Email.ini", "Emails")
    Dim $Checkbox[$Section[0][0]+1]

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

    $Form1 = GUICreate("Email Prog", 400, Round($section[0][0]/2)*30+290)
    For $i = 1 To $Section[0][0]
    $Checkbox[$i] = GUICtrlCreateCheckbox($Section[$i][0], 205 - Mod($i, 2)*200, 5 + (Round($i/2) - 1)*30, 190, 25)
    Next
    $label1 = GUICtrlCreateLabel("_________________________________________________________________", 5, (Mod($section[0][0], 2) +Round($i/2) - 1)*30 - 5, 390, 25)
    $label2 = GUICtrlCreateLabel("Betreff:", 5, 20 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Input1 = GUICtrlCreateInput(IniRead("Email.ini", "Standards", "Betreff", ""), 5, 35 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    $label2 = GUICtrlCreateLabel("Nachrichttext:", 5, 80 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Edit1 = GUICtrlCreateEdit(StringReplace(IniRead("Email.ini", "Standards", "Nachricht", ""), " |@CRLF| ", @CRLF) , 5, 95 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 100)
    $label3 = GUICtrlCreateLabel("Empfänger:", 5, 215 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Input2 = GUICtrlCreateInput("", 5, 230 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    $Button1 = GUICtrlCreateButton("Standards speichern", 5, 260 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 120, 25)
    $Button2 = GUICtrlCreateButton("Email senden", 135, 260 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 130, 25)
    $Combo1 = GUICtrlCreateCombo("", 275, 261 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 120, 30, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUISetState(@SW_SHOW)

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

    $signaturs = _FileListToArray(@AppDataDir & "\Microsoft\Signatures", "*.txt", 1)
    If IsArray($signaturs) Then
    For $i = 1 To $signaturs[0] Step 1
    $combodata &= $signaturs[$i] & "|"
    Next
    GUICtrlSetData($Combo1, " |" &$combodata, $signaturs[$i - 1])
    Else
    GUICtrlSetState($Combo1, $GUI_DISABLE)
    EndIf

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Checkbox[1] To $Checkbox[$Section[0][0]]
    $emails = ""
    For $i = 1 To $Section[0][0]
    If BitAnd(GUICtrlRead($Checkbox[$i]), $GUI_CHECKED) Then
    $emails &= $Section[$i][1] & "; "
    EndIf
    Next
    Guictrlsetdata($Input2, $emails)
    Case $Button1
    IniWrite("Email.ini", "Standards", "Betreff", GUICtrlRead($Input1))
    IniWrite("Email.ini", "Standards", "Nachricht", StringReplace(GUICtrlRead($Edit1), @CRLF, " |@CRLF| "))
    Case $Button2
    If FileExists(@AppDataDir & "\Microsoft\Signatures\" & GUICtrlRead($Combo1)) Then
    $signatur = FileRead(@AppDataDir & "\Microsoft\Signatures\" & GUICtrlRead($Combo1))
    Else
    $signatur = ""
    EndIf
    _INetMail(GUICtrlRead($Input2), GUICtrlRead($Input1), GUICtrlRead($Edit1) & @CRLF & @CRLF & $signatur)
    EndSwitch
    WEnd

    [/autoit]

    Email.ini

    Spoiler anzeigen
    [autoit]

    [Emails]
    Klaus=klaus@anbieter.de
    Peter=peter@anbieter.de
    Claudia=claudia@anbieter.de
    Susi=susi@anbieter.de
    Rodi=rodi@anbieter.de
    [Standards]
    Betreff=Standard Betreff
    Nachricht=Standart Nachricht |@CRLF| Zeile 2 |@CRLF| Zeile 3

    [/autoit]


    Wer kann mir bitte helfen?

    Viele Grüße,
    Dino

  • hi dino,

    hatte endlich mal ne viertl stunde zeit mir das nochmal anzuschaun.
    die lösung ist zwar nicht die sauberste aber bei mir funktioniert sie bugfrei.

    zuerst musst du dir aber die signatur in outlook anglegen, die du als standard verwenden willst. unter: Extras --> Optionen --> Email-Format --> Signaturen --> Neu
    WICHTIG IST: Die signatur muss die erste in der liste sein. d.h. AAAAA oder sowas ;)
    name ist aber egal hauptsache erste ;)

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <Inet.au3>
    Global $section, $combodata
    $section = IniReadSection("Email.ini", "Emails")
    Dim $Checkbox[$Section[0][0]+1]

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

    $Form1 = GUICreate("Email Prog", 400, Round($section[0][0]/2)*30+290)
    For $i = 1 To $Section[0][0]
    $Checkbox[$i] = GUICtrlCreateCheckbox($Section[$i][0], 205 - Mod($i, 2)*200, 5 + (Round($i/2) - 1)*30, 190, 25)
    Next
    $label1 = GUICtrlCreateLabel("_________________________________________________________________", 5, (Mod($section[0][0], 2) +Round($i/2) - 1)*30 - 5, 390, 25)
    $label2 = GUICtrlCreateLabel("Betreff:", 5, 20 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Input1 = GUICtrlCreateInput(IniRead("Email.ini", "Standards", "Betreff", ""), 5, 35 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    $label2 = GUICtrlCreateLabel("Nachrichttext:", 5, 80 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Edit1 = GUICtrlCreateEdit(StringReplace(IniRead("Email.ini", "Standards", "Nachricht", ""), " |@CRLF| ", @CRLF) , 5, 95 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 100)
    $label3 = GUICtrlCreateLabel("Empfänger:", 5, 215 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Input2 = GUICtrlCreateInput("", 5, 230 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    $Button1 = GUICtrlCreateButton("Standards speichern", 5, 260 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 190, 25)
    $Button2 = GUICtrlCreateButton("Email senden", 205, 260 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 190, 25)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Checkbox[1] To $Checkbox[$Section[0][0]]
    $emails = ""
    For $i = 1 To $Section[0][0]
    If BitAnd(GUICtrlRead($Checkbox[$i]), $GUI_CHECKED) Then
    $emails &= $Section[$i][1] & "; "
    EndIf
    Next
    Guictrlsetdata($Input2, $emails)
    Case $Button1
    IniWrite("Email.ini", "Standards", "Betreff", GUICtrlRead($Input1))
    IniWrite("Email.ini", "Standards", "Nachricht", StringReplace(GUICtrlRead($Edit1), @CRLF, " |@CRLF| "))
    Case $Button2
    _INetMail(GUICtrlRead($Input2), GUICtrlRead($Input1), GUICtrlRead($Edit1) & @CRLF & @CRLF)
    WinWaitActive("[CLASS:rctrl_renwnd32]")
    Send("^{End}")
    Send("!eso")
    WinWait("Wählen Sie eine Signatur", "")
    ControlClick("Wählen Sie eine Signatur", "", "[CLASS:Button; INSTANCE:4]")
    EndSwitch
    WEnd

    [/autoit]
  • oh ja höchstwahrscheinlich sind sie da anders. office 07 sieht 03 ja nicht unbedingt ähnlich...

    ich werds mir zuhause mal ansehn, hier arbeiten wir leider noch mit 03...

  • Hallo Schnitzel,

    in Outlook 2007 lässt sich die Signatur mit tastenkombination ALT+H+S+Enter. Durchs ausprobieren gefunden :P

    Die Signatur wird aber vor dem Text aus Edit1 eingefügt und nicht am Ende.
    Wie springt man zu Ende, nachdem der Nachrichtentext in der e-Mail eingefügt ist, damit dann die Signatur eingefügt werden kann?

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <Inet.au3>
    Global $section, $combodata
    $section = IniReadSection("Email.ini", "Emails")
    Dim $Checkbox[$Section[0][0]+1]

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

    $Form1 = GUICreate("Email Prog", 400, Round($section[0][0]/2)*30+290)
    For $i = 1 To $Section[0][0]
    $Checkbox[$i] = GUICtrlCreateCheckbox($Section[$i][0], 205 - Mod($i, 2)*200, 5 + (Round($i/2) - 1)*30, 190, 25)
    Next
    $label1 = GUICtrlCreateLabel("_________________________________________________________________", 5, (Mod($section[0][0], 2) +Round($i/2) - 1)*30 - 5, 390, 25)
    $label2 = GUICtrlCreateLabel("Betreff:", 5, 20 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Input1 = GUICtrlCreateInput(IniRead("Email.ini", "Standards", "Betreff", ""), 5, 35 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    $label2 = GUICtrlCreateLabel("Nachrichttext:", 5, 80 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Edit1 = GUICtrlCreateEdit(StringReplace(IniRead("Email.ini", "Standards", "Nachricht", ""), " |@CRLF| ", @CRLF) , 5, 95 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 100)
    $label3 = GUICtrlCreateLabel("Empfänger:", 5, 215 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    GUICtrlSetColor(-1, 0x1B79D9)
    $Input2 = GUICtrlCreateInput("", 5, 230 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 390, 25)
    $Button1 = GUICtrlCreateButton("Standards speichern", 5, 260 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 190, 25)
    $Button2 = GUICtrlCreateButton("Email senden", 205, 260 + (Mod($section[0][0], 2) +Round($i/2) - 1)*30, 190, 25)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Checkbox[1] To $Checkbox[$Section[0][0]]
    $emails = ""
    For $i = 1 To $Section[0][0]
    If BitAnd(GUICtrlRead($Checkbox[$i]), $GUI_CHECKED) Then
    $emails &= $Section[$i][1] & "; "
    EndIf
    Next
    Guictrlsetdata($Input2, $emails)
    Case $Button1
    IniWrite("Email.ini", "Standards", "Betreff", GUICtrlRead($Input1))
    IniWrite("Email.ini", "Standards", "Nachricht", StringReplace(GUICtrlRead($Edit1), @CRLF, " |@CRLF| "))
    Case $Button2
    _INetMail(GUICtrlRead($Input2), GUICtrlRead($Input1), GUICtrlRead($Edit1) & @CRLF & @CRLF)
    WinWaitActive("[CLASS:rctrl_renwnd32]")
    Send("{ALTDOWN}h{ALTUP}s")
    WinActive("classname=Net UI Tool Window","")
    Send("{ENTER}")
    EndSwitch
    WEnd

    [/autoit]


    VG,
    Dino