Outlook UDF nicht vorhandene User Filtern

  • Hallo zusammen,

    ich habe ein dringendes Problem.


    wenn ich über das Outlook UDF eine Mail versenden will (im Auftrag von ) und in der Liste ein User ist der nicht im Outlookadressbuch ist gibt es einen Fehler wenn die Person an erster
    Stelle steht oder wenn er an 2. Stelle steht werden keine Mails an alle die dahinter stehen geschickt.

    Das ist fatal! gibt es eine Möglichkeit diese User Automatisch zu Filtern oder nicht zu beachten ?


    Hier einmal die Senden Funktion:

    [autoit]


    Func Senden()
    Global $iMax
    Global $iMax1
    Global $iMax2
    Local $data = $pto
    Local $data1 = $pcc
    Local $data2 = _GUICtrlEdit_GetText($fbcc)
    Global $to = StringSplit($data, ";",2)
    Global $cc = StringSplit($data1, ";",2)
    Global $bcc = StringSplit($data2, ";",2)

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

    If IsArray($to) Then
    $iMax = UBound($to); get array size
    For $i = 0 to $iMax - 1; subtract 1 from size to prevent an out of bounds error
    Next
    EndIf

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

    If IsArray($cc) Then
    $iMax1 = UBound($cc); get array size
    For $i = 0 to $iMax1 - 1; subtract 1 from size to prevent an out of bounds error
    Next
    EndIf

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

    If IsArray($bcc) Then
    $iMax2 = UBound($bcc); get array size
    For $i = 0 to $iMax - 1; subtract 1 from size to prevent an out of bounds error
    Next
    EndIf

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

    #ConsoleWrite($to[0] & @CRLF)
    #ConsoleWrite($to[1] & @CRLF)

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

    ; Open the connection to Outlook
    Global $oOL = _OL_Open()

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

    ; Create a mail item and set some properties
    Global $oItem = _OL_ItemCreate($oOL, $olMailItem, "*", "", "Subject=" & $betreff, "BodyFormat=" & $olFormatHTML, "HTMLBody=" & $textfeld, "SentOnBehalfOfName=Servicedesk")
    ConsoleWrite("itemcreate error " & @error & " Extendet " & @extended & @CRLF)

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

    ; Add a recipient and resolve it
    _OL_ItemRecipientAdd($oOL, $oItem, Default, $olTo, $to)
    _OL_ItemRecipientAdd($oOL, $oItem, Default, $olcc, $cc)
    _OL_ItemRecipientAdd($oOL, $oItem, Default, $olbcc, $bcc)
    ConsoleWrite("itemrecive error " & @error & " Extendet " & @extended & @CRLF)

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

    ; Send the mail
    _OL_ItemSend($oOL, $oItem)
    If @extended = -2147352567 Then _
    MsgBox(16, "OutlookEX UDF - Example Script", "You don't have permission to send the mail on behalf of the specified person!")
    ConsoleWrite("send error " & @error & " Extendet " & @extended & @CRLF)

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

    EndFunc

    [/autoit]

    ich hoffe ihr könnt mir helfen.

    Gruß
    Florian

  • Dafür gibt es die Funktion _OL_RecipientCheck. Damit lässt sich prüfen, ob der/die Empfänger gültig ist.

  • Water deine scripte sind ich Hammer aber auch sehr kompliziert zumindest wenn man nicht vollzeitprogrammierer ist.


    Wenn ich jetzt mal ein Stück aus der Vorlage nehme:

    [autoit]


    Global $aResult = _OL_ItemRecipientCheck($oOL, $vRecipients ????? ) ;hier würde ich dann ja mein gefülltes Array eintragen wo die ganzen Empfänger drin sind oder ? das wäre bei mir $to aber wie übergebe ich das ? ich bekomme immer Fehler |2 - $vRecipients is empty

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

    If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemRecipientCheck Example Script", "Error frunning _OL_ItemRecipientCheck. @error = " & @error & ", @extended = " & @extended)
    _ArrayDisplay($aResult, "OutlookEX UDF: _OL_RecipientCheck Example Script", _
    -1, 0, "", "|", "Row|Recipient|Resolved?|Recipient object|AddressEntry object|Mail address|DisplayType|Name")

    [/autoit]


    Gruß Flo

  • Die Funktion erwartet die Recipients als String getrennt durch ";":
    "Name, Alias or SMTP mail address of one or multiple recipients separated by ;"
    Nimm also

    [autoit]

    $sToCheck = _ArrayToString($To, ";")

    [/autoit]
  • Ich bekomme leider kein gescheites Ergebnis.

    [Blockierte Grafik: http://up.picr.de/19611188rb.jpg]

    nur eine leeres Array Display.
    ich habe das Array so übergeben:

    [autoit]


    Global $aResult = _OL_ItemRecipientCheck($oOL, $sToCheck = _ArrayToString($to, ";"))

    [/autoit]


    So hatte ich es auch noch versucht:

    [autoit]


    $sToCheck = _ArrayToString($to, ";")
    Global $aResult = _OL_ItemRecipientCheck($oOL, $sToCheck)

    [/autoit]


    wie ist das wenn ein User der nicht im Adressbuch ist gefundden wird muss der dann mit der Funktion _OL_ItemRecipientDelete entfernt werden ?

  • Dieses Beispiel zeigt, wie sich eine falsche Adresse (Nummer 3) von korrekten unterscheidet:

    [autoit]

    #include <OutlookEX.au3>

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

    Global $oOutlook = _OL_Open()
    If @error Then Exit MsgBox(16, "OutlookEX UDF - _OL_RecipientCheck Example Script", "Error running _OL_Open. @error = " & @error & ", @extended = " & @extended)

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

    Global $aResult = _OL_ItemRecipientCheck($oOutlook, $oOutlook.GetNameSpace("MAPI").CurrentUser.Name & ";[email='test.user@google.com'][/email];Wrong address")
    If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemRecipientCheck Example Script", "Error frunning _OL_ItemRecipientCheck. @error = " & @error & ", @extended = " & @extended)
    _ArrayDisplay($aResult, "OutlookEX UDF: _OL_RecipientCheck Example Script", _
    "", 0, "|", "Row|Recipient|Resolved?|Recipient object|AddressEntry object|Mail address|DisplayType|Name")

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

    _OL_Close($oOutlook)

    [/autoit]
  • Ok schätze jetzt klappt es, keine Ahnung was das Problem war habe alles per Hand noch einmal neu geschrieben dann ging es.

    aber nun wird mir ja das ganze Array ausgegeben mit True oder False, wie Filtere ich die False raus und gebe den Rest weiter an _OL_ItemSend ?
    Es soll ja Automatisch ablaufen ohne das der User etwas dazu tun muss.

    Evtl eine Ausgabe welche Empfänger False sind.

  • In einem Loop durchs Array gehen und nur jene mit True in einem String zusammenfassen und mit ";" trennen?

  • Das mit dem auslesen der True Daten und in ein String zusammen fassen klappt jetzt nicht wirklich

    ich habe einiges versucht, aber ich muss zugeben ich weiß schlicht weg nicht wie das geht :(

    [autoit]


    If IsArray($aResult) Then
    For $i = 0 to UBound($aResult) -1

    Next
    EndIf

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

    muss ich das mit _arraySearch machen ?

    Edit: Ich habe natürlich gesucht, aber das scheint alles irgendwie nicht zu passen

  • Du musstdringend Deine Array Kenntnisse auffrischen ;)

    [autoit]

    Global $sTo = ""
    For $i = 1 To $aResult[0][0]
    If $aResult[$i][1] = True Then $sTo &= $aResult[$i][0] & ";"
    Next
    ConsoleWrite($sTo & @CRLF)

    [/autoit]
  • Du musstdringend Deine Array Kenntnisse auffrischen ;)


    Da hast Du recht und nicht nur das... :)

    Also das Filtern klapp soweit gut aber das Übergeben an die _OL_ItemRecipientAdd bzw. Senden da bekomme ich den "no permission" fehler allerdings ohne Error und Extendet code.
    itemcreate error 0 Extendet 0
    itemrecive error 0 Extendet 0
    send error 0 Extendet 0

    Die Werte in der gefilterten Variable $sTo scheinen korrekt
    Nachname, Vorname;Nachname, Vorname; etc.

    hier nochmal die Senden Funktion:

    [autoit]


    Func Senden()
    Global $iMax
    Global $iMax1
    Global $iMax2
    Local $data = $pto
    Local $data1 = $pcc
    Local $data2 = _GUICtrlEdit_GetText($fbcc)
    Global $to = StringSplit($data, ";",2)
    Global $cc = StringSplit($data1, ";",2)
    Global $bcc = StringSplit($data2, ";",2)
    If IsArray($to) Then
    $iMax = UBound($to)
    For $i = 0 to $iMax - 1
    Next
    EndIf

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

    If IsArray($cc) Then
    $iMax1 = UBound($cc)
    For $i = 0 to $iMax1 - 1
    Next
    EndIf

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

    If IsArray($bcc) Then
    $iMax2 = UBound($bcc)
    For $i = 0 to $iMax - 1
    Next
    EndIf

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

    ; Open the connection to Outlook
    Global $oOL = _OL_Open()

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

    ; Mailusertest

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

    Global $TOstring = _ArrayToString($to, ";")

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

    Global $aResult = _OL_ItemRecipientCheck($oOL, $TOstring)
    ConsoleWrite("Check " & @error & " Extendet " & @extended & @CRLF)
    If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemRecipientCheck Example Script", "Error frunning _OL_ItemRecipientCheck. @error = " & @error & ", @extended = " & @extended)
    _ArrayDisplay($aResult, "OutlookEX UDF: _OL_RecipientCheck Example Script", _
    "", 0, "|", "Row|Recipient|Resolved?|Recipient object|AddressEntry object|Mail address|DisplayType|Name")

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

    Global $sTo = ""
    For $i = 1 To $aResult[0][0]
    If $aResult[$i][1] = True Then $sTo &= $aResult[$i][6] & ";"
    Next

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

    ConsoleWrite($sTo & @CRLF)

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

    ; Create a mail item and set some properties
    Global $oItem = _OL_ItemCreate($oOL, $olMailItem, "*", "", "Subject=" & $betreff, "BodyFormat=" & $olFormatHTML, "HTMLBody=" & $textfeld, "SentOnBehalfOfName=Servicedesk")
    ConsoleWrite("itemcreate error " & @error & " Extendet " & @extended & @CRLF)

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

    ; Add a recipient and resolve it
    _OL_ItemRecipientAdd($oOL, $oItem, Default, $olTo, $sTo)
    _OL_ItemRecipientAdd($oOL, $oItem, Default, $olcc, $cc)
    _OL_ItemRecipientAdd($oOL, $oItem, Default, $olbcc, $bcc)
    ConsoleWrite("itemrecive error " & @error & " Extendet " & @extended & @CRLF)

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

    ; Send the mail
    _OL_ItemSend($oOL, $oItem)
    If @extended = -2147352567 Then _
    MsgBox(16, "OutlookEX UDF - Example Script", "You don't have permission to send the mail on behalf of the specified person!")
    ConsoleWrite("send error " & @error & " Extendet " & @extended & @CRLF)

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

    EndFunc

    [/autoit]
  • Der "permission error" zeigt an, dass Du keine "permission" sprich Berechtigung hast :)
    Der Eigentümer der Mailbox muss Dir erlauben, dass Du in seinem Namen Mails versenden darfst.

  • ich habe die Berechtigung ohne die Checkfunktion klappt es ja bzw. wenn kein Empfänger drin steht der ungültig ist.
    und nun kommt nach dem Filtern auch der Fehler obeohl es passen müsste da alle Empfänger gültig sind.

    hast Du noch eine Idee woran das liegen könnte ?

  • Mein Fehler.
    RecipientAdd erwartet 1-10 Empfänger Objekte, 1-10 Empfänger Namen oder einen Array an Empfängern (Objekt oder Name). Was möchtest Du übergeben?

  • Hier ein funktionierendes Beispiel. "John Doe" musst Du noch durch einen gültigen Namen ersetzen. Einige zeilen habe ich auskommentiert oder den für den Test nicht verwendbaren Teil nach rechts in einen Kommentar verschoben.

    [autoit]

    #include <OutlookEx.au3>
    Global $pcc = "", $Betreff = "TestBetreff", $textfeld = "TestText"
    Senden()
    Exit

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

    Func Senden()
    Local $data = "john doe;xyz123" ; $pto
    Local $data1 = $pcc
    Local $data2 = "" ; _GUICtrlEdit_GetText($fbcc)
    Local $cc = StringSplit($data1, ";", 2)
    Local $bcc = StringSplit($data2, ";", 2)

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

    ; Open the connection to Outlook
    Global $oOL = _OL_Open()

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

    ; Mailusertest
    Global $aResult = _OL_ItemRecipientCheck($oOL, $data)
    If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemRecipientCheck Example Script", "Error frunning _OL_ItemRecipientCheck. @error = " & @error & ", @extended = " & @extended)
    _ArrayDisplay($aResult, "OutlookEX UDF: _OL_RecipientCheck Example Script", _
    "", 0, "|", "Row|Recipient|Resolved?|Recipient object|AddressEntry object|Mail address|DisplayType|Name")

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

    Global $aTo[$aResult[0][0]], $j = 0
    For $i = 1 To $aResult[0][0]
    If $aResult[$i][1] = True Then
    $aTo[$j] = $aResult[$i][2]
    $j = $j + 1
    Endif
    Next

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

    ; Create a mail item and set some properties
    Global $oItem = _OL_ItemCreate($oOL, $olMailItem, "*", "", "Subject=" & $betreff, "BodyFormat=" & $olFormatHTML, "HTMLBody=" & $textfeld) ; , "SentOnBehalfOfName=Servicedesk")

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

    ; Add a recipient and resolve it
    _OL_ItemRecipientAdd($oOL, $oItem, Default, $olTo, $aTo)
    ; _OL_ItemRecipientAdd($oOL, $oItem, Default, $olcc, $cc)
    ; _OL_ItemRecipientAdd($oOL, $oItem, Default, $olbcc, $bcc)

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

    ; Send the mail
    _OL_ItemSend($oOL, $oItem)
    If @extended = -2147352567 Then _
    MsgBox(16, "OutlookEX UDF - Example Script", "You don't have permission to send the mail on behalf of the specified person!")

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

    EndFunc ;==>Senden

    [/autoit]
  • Andere alternative:
    Ich habe _OL_ItemRecipientCheck so angepasst, dass es einen Array zurückggibt, der nur die gültigen Adressen beinhaltet und direkt an _OL_ItemRecipientAddweitergegeben werden kann.
    Beispiel:

    Spoiler anzeigen
    [autoit]

    #include <OutlookEx.au3>
    Global $oOL = _OL_Open()

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

    Global $aResult = _OL_ItemRecipientCheckEx($oOL, "<< Hier gültigen Empfänger eingeben >>", "", "", "", "", "", "", "", "", "", True)
    Global $oItem = _OL_ItemCreate($oOL, $olMailItem, "*", "", "Subject=Test", "BodyFormat=" & $olFormatHTML, "HTMLBody=TestBody")
    _OL_ItemRecipientAdd($oOL, $oItem, Default, $olTo, $aResult)
    $oItem.Display
    _OL_Close($oOL)
    Exit

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

    ; #FUNCTION# ====================================================================================================================
    ; Name ..........: _OL_ItemRecipientCheck
    ; Description ...: Checks one/more recipients to be valid.
    ; Syntax.........: _OL_ItemRecipientCheck($oOL, $sP1[, $sP2 = ""[, $sP3 = ""[, $sP4 = ""[, $sP5 = ""[, $sP6 = ""[, $sP7 = ""[, $sP8 = ""[, $sP9 = ""[, $sP10 = ""[, $bOnlyValid = False]]]]]]]]]])
    ; Parameters ....: $oOL - Outlook object returned by a preceding call to _OL_Open()
    ; $sP1 - Name, Alias or SMTP mail address of one or multiple recipients separated by ";" ($sP2 to $sP10 are ignored if ";" is used)
    ; +or a zero based one-dimensional array with unlimited number of recipients
    ; $sP2 - Optional: Name, Alias or SMTP mail address of a single recipient (no concatenation of recipients using ";" allowed)
    ; $sP3 - Optional: Same as $sP2
    ; $sP4 - Optional: Same as $sP2
    ; $sP5 - Optional: Same as $sP2
    ; $sP6 - Optional: Same as $sP2
    ; $sP7 - Optional: Same as $sP2
    ; $sP8 - Optional: Same as $sP2
    ; $sP9 - Optional: Same as $sP2
    ; $sP10 - Optional: Same as $sP2
    ; $bOnlyValid - Optional: Only return the resolved recipients objects in a one-dimensional zero based array (default = False)
    ; Return values .: Success - two-dimensional one based array with the following information (for $bOnlyValid = False):
    ; |0 - Recipient derived from the list of recipients in $sP1
    ; |1 - True if the recipient could be resolved successfully
    ; |2 - Recipient object as returned by the Resolve method
    ; |3 - AddressEntry object
    ; |4 - Recipients mail address (empty for distribution lists). This can be:
    ; | PrimarySmtpAddress for an Exchange User
    ; | Email1Address for an Outlook contact
    ; | Empty for Exchange or Outlook distribution lists
    ; |5 - Display type is one of the OlDisplayType enumeration that describes the nature of the recipient
    ; |6 - Display name of the recipient
    ; Success - one-dimensional zero based array with the following information (for $bOnlyValid = True):
    ; |0 - Recipient object which was successfully resolved by the Resolve method. Unresolveable recipients are not aprt of the result!
    ; Failure - Returns "" and sets @error:
    ; |1 - $oOL is not an object
    ; |2 - $sP1 is empty
    ; |3 - Error creating recipient object. @extended contains the error returned by method CreateRecipient
    ; Author ........: water
    ; Modified ......:
    ; Remarks .......: When $bOnlyValid = True you get a one-dimensional zero based array with all invalid recipients removed.
    ; This array can easily be passed to _OL_ItemRecipientAdd.
    ; Related .......:
    ; Link ..........:
    ; Example .......: Yes
    ; ===============================================================================================================================
    Func _OL_ItemRecipientCheckEx($oOL, $sP1, $sP2 = "", $sP3 = "", $sP4 = "", $sP5 = "", $sP6 = "", $sP7 = "", $sP8 = "", $sP9 = "", $sP10 = "", $bOnlyValid = False)

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

    Local $oRecipient, $asRecipients[10]
    If Not IsObj($oOL) Then Return SetError(1, 0, "")
    If StringStripWS($sP1, 3) = "" Then Return SetError(2, 0, "")
    ; Move recipients into an array
    If Not IsArray($sP1) Then
    If StringInStr($sP1, ";") > 0 Then
    $asRecipients = StringSplit($sP1, ";", 2)
    Else
    $asRecipients[0] = $sP1
    $asRecipients[1] = $sP2
    $asRecipients[2] = $sP3
    $asRecipients[3] = $sP4
    $asRecipients[4] = $sP5
    $asRecipients[5] = $sP6
    $asRecipients[6] = $sP7
    $asRecipients[7] = $sP8
    $asRecipients[8] = $sP9
    $asRecipients[9] = $sP10
    EndIf
    Else
    $asRecipients = $sP1
    EndIf
    If $bOnlyValid Then
    Local $asResult[UBound($asRecipients, 1)]
    Local $iIndex2 = 0
    Else
    Local $asResult[UBound($asRecipients, 1) + 1][7] = [[UBound($asRecipients, 1), 7]]
    Local $iIndex2 = 1
    EndIf
    For $iIndex = 0 To UBound($asRecipients, 1) - 1
    If StringStripWS($asRecipients[$iIndex], 3) = "" Then ContinueLoop
    If Not $bOnlyValid Then $asResult[$iIndex2][0] = $asRecipients[$iIndex]
    $oRecipient = $oOL.Session.CreateRecipient($asRecipients[$iIndex])
    If @error Or Not IsObj($oRecipient) Then Return SetError(3, @error, "")
    $oRecipient.Resolve
    If @error Or Not $oRecipient.Resolved Then
    If $bOnlyValid Then ContinueLoop
    $asResult[$iIndex2][1] = False
    Else
    If $bOnlyValid Then
    $asResult[$iIndex2] = $oRecipient
    Else
    $asResult[$iIndex2][1] = True
    $asResult[$iIndex2][2] = $oRecipient
    Switch $oRecipient.AddressEntry.AddressEntryUserType
    ; Exchange user that belongs to the same or a different Exchange forest
    Case $olExchangeUserAddressEntry, $olExchangeRemoteUserAddressEntry
    $asResult[$iIndex2][3] = $oRecipient.AddressEntry.GetExchangeUser
    $asResult[$iIndex2][4] = $oRecipient.AddressEntry.GetExchangeUser.PrimarySmtpAddress
    ; Address entry in an Outlook Contacts folder
    Case $olOutlookContactAddressEntry
    $asResult[$iIndex2][3] = $oRecipient.AddressEntry.GetContact
    $asResult[$iIndex2][4] = $oRecipient.AddressEntry.GetContact.Email1Address
    ; Address entry in an Exchange Distribution list
    Case $olExchangeDistributionListAddressEntry
    $asResult[$iIndex2][3] = $oRecipient.AddressEntry.GetExchangeDistributionList
    ; Address entry in an an Outlook distribution list
    Case $olOutlookDistributionListAddressEntry
    $asResult[$iIndex2][3] = $oRecipient.AddressEntry
    Case Else
    EndSwitch
    $asResult[$iIndex2][5] = $oRecipient.DisplayType
    $asResult[$iIndex2][6] = $oRecipient.Name
    EndIf
    EndIf
    $iIndex2 = $iIndex2 + 1
    Next
    If $bOnlyValid Then ReDim $asResult[$iIndex2]
    Return $asResult

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

    EndFunc ;==>_OL_ItemRecipientCheckEx

    [/autoit]
  • kannst Du mir erklären warum alle Empfänger ob To (was ja ok ist) aber auch CC in der An Zeile landenden wenn die Mail gesendet wird ?

    übergeben wird mit to und cc gesendet wird alles in to und ich kann den Fehler nicht finden. Die Wertübergaben sehen alle gut aus so wie ich das sehe.
    Könntest Du nochmal einen Blick drauf werfen ?

    Übrigens die "neue Funktion" ist SUPER :thumbup: jetzt geht es sehr einfach.

    [autoit]


    Func Senden()

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

    Local $data = $pto
    Local $data1 = $pcc
    Local $bcc = _GUICtrlEdit_GetText($fbcc)
    ;Global $to = StringSplit($data, ";",2)
    ;Global $cc = StringSplit($data1, ";",2)
    ;Global $data2 = StringSplit($bcc, ";",2)

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

    Global $textfeld = stringreplace(_GUICtrlEdit_GetText($Edit1), @CRLF, "<br>")
    Global $betreff=$pnotfall & " " & $melde

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

    ; Open the connection to Outlook
    Global $oOL = _OL_Open()

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

    ; Mailusertest TO & CC

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

    Global $aResult = _OL_ItemRecipientCheckEx($oOL, $data, "", "", "", "", "", "", "", "", "", True)
    Global $aResult1 = _OL_ItemRecipientCheckEx($oOL, $data1, "", "", "", "", "", "", "", "", "", True)

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

    ; Create a mail item and set some properties
    Global $oItem = _OL_ItemCreate($oOL, $olMailItem, "*", "", "Subject=" & $betreff, "BodyFormat=" & $olFormatHTML, "HTMLBody=" & $textfeld, "SentOnBehalfOfName=Servicedesk@hermes-europe.eu")
    ConsoleWrite("itemcreate error " & @error & " Extendet " & @extended & @CRLF)

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

    ; Add a recipient and resolve it
    _OL_ItemRecipientAdd($oOL, $oItem, Default, $olTo, $aResult)
    _OL_ItemRecipientAdd($oOL, $oItem, Default, $olCC, $aResult1)
    ;_OL_ItemRecipientAdd($oOL, $oItem, Default, $olbcc, $aBcc)
    ConsoleWrite("itemrecive error " & @error & " Extendet " & @extended & @CRLF)

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

    ; Send the mail
    _OL_ItemSend($oOL, $oItem)
    If @extended = -2147352567 Then _
    MsgBox(16, "OutlookEX UDF - Example Script", "You don't have permission to send the mail on behalf of the specified person!")
    ConsoleWrite("send error " & @error & " Extendet " & @extended & @CRLF)

    [/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit]
  • Muss ich am Montag mal checken.