_INetSmtpMailAuth und Win2003

  • Hallo zusammen,
    Die Funktion _INetSmtpMailAuth von Bernd funktioniert echt toll, nur leider geht nix unter Windows2003, hat da schon jemand Erfahrung mit gemacht? Es kommt immer Error 4 "Unable to create socket"

    Spoiler anzeigen
    [autoit]


    ;===============================================================================
    ;
    ; Function Name: _INetSmtpMailAuth()
    ; Description: Sends an email using SMTP over TCP IP.
    ; Parameter(s): $s_SmtpServer - SMTP server to be used for sending email
    ; $s_FromName - Name of sender
    ; $s_FromAddress - eMail address of sender
    ; $s_ToAddress - Address that email is to be sent to
    ; $s_Username - Username for Authentication (bernd670)
    ; $s_Passwd - Password for Authentication (bernd670)
    ; $s_Subject - Subject of eMail
    ; $as_Body - Single dimension array containing the body of eMail as strings
    ; $s_helo - Helo identifier (default @COMPUTERNAME) sometime needed by smtp server
    ; $s_first - send before Helo identifier (default @CRLF) sometime needed by smtp server
    ; $b_trace - trace on a splash window (default 0 = no trace)
    ; Requirement(s): None
    ; Return Value(s): On Success - Returns 1
    ; On Failure - 0 and sets
    ; @ERROR = 1 - Invalid Parameters
    ; @ERROR = 2 - Unable to start TCP
    ; @ERROR = 3 - Unable to resolve IP
    ; @ERROR = 4 - Unable to create socket
    ; @ERROR = 5x - Cannot open SMTP session
    ; @ERROR = 50x - Cannot send body
    ; @ERROR = 5000 - Cannot close SMTP session
    ; Authors: Original function to send email via TCP - Asimzameer
    ; Conversion to UDF - Walkabout
    ; Correction Helo, timeout, trace - Jpm
    ; Correction send before Helo - Jpm
    ; Include Authentication - bernd670
    ;
    ;===============================================================================

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

    Func _INetSmtpMailAuth($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Username, $s_Passwd, $s_Subject = "", $as_Body = "", $s_helo = "", $s_first = "-1", $b_trace = 0)

    Local $v_Socket
    Local $s_IPAddress
    Local $i_Count
    Local $s_Send[9]
    Local $s_ReplyCode[9];Return code from SMTP server indicating success

    If $s_SmtpServer = "" Or $s_FromAddress = "" Or $s_ToAddress = "" Or $s_Username = "" Or $s_Passwd = "" Or $s_FromName = "" Or StringLen($s_FromName) > 256 Then
    SetError(1)
    Return 0
    EndIf
    If $s_helo = "" Then $s_helo = @ComputerName
    If TCPStartup() = 0 Then
    SetError(2)
    Return 0
    EndIf
    StringRegExp($s_SmtpServer, "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)")
    If @extended Then
    $s_IPAddress = $s_SmtpServer
    Else
    $s_IPAddress = TCPNameToIP($s_SmtpServer)
    EndIf
    If $s_IPAddress = "" Then
    TCPShutdown()
    SetError(3)
    Return 0
    EndIf
    $v_Socket = TCPConnect($s_IPAddress, 80)
    If $v_Socket = -1 Then
    TCPShutdown()
    SetError(4)
    Return (0)
    EndIf

    $s_Send[0] = "EHLO " & $s_helo & @CRLF
    ;~ If StringLeft($s_helo,5) <> "EHLO " Then $s_Send[0] = "EHLO " & $s_helo & @CRLF
    $s_ReplyCode[0] = "250"

    $s_Send[1] = "AUTH LOGIN" & @CRLF
    $s_ReplyCode[1] = "334"
    $s_Send[2] = _Base64Encoding($s_Username) & @CRLF
    $s_ReplyCode[2] = "334"
    $s_Send[3] = _Base64Encoding($s_Passwd) & @CRLF
    $s_ReplyCode[3] = "235"
    $s_Send[4] = "MAIL FROM: <" & $s_FromAddress & ">" & @CRLF
    $s_ReplyCode[4] = "250"
    $s_Send[5] = "RCPT TO: <" & $s_ToAddress & ">" & @CRLF
    $s_ReplyCode[5] = "250"
    $s_Send[6] = "DATA" & @CRLF
    $s_ReplyCode[6] = "354"

    $s_Send[7] = "From: " & $s_FromName & " <" & $s_FromAddress & ">" & @CRLF & _
    "To: " & "<" & $s_ToAddress & ">" & @CRLF & _
    "Subject: " & $s_Subject & @CRLF & _
    "Mime-Version: 1.0" & @CRLF & _
    "Content-Type: text/plain; charset=US-ASCII" & @CRLF & _
    @CRLF
    $s_ReplyCode[7] = ""

    $s_Send[8] = @CRLF & "." & @CRLF
    $s_ReplyCode[8] = "250"

    ; open stmp session
    If _SmtpSend ($v_Socket, $s_Send[0], $s_ReplyCode[0], $b_trace, "220", $s_first) Then
    SetError(50)
    Return 0
    EndIf

    ; send header
    For $i_Count = 0 To UBound($s_Send) - 2
    If _SmtpSend ($v_Socket, $s_Send[$i_Count], $s_ReplyCode[$i_Count], $b_trace) Then
    SetError(50 + $i_Count)
    Return 0
    EndIf
    Next

    ; send body records (a record can be multiline : take care of a subline beginning with a dot should be ..)
    For $i_Count = 0 To UBound($as_Body) - 1
    ; correct line beginning with a dot
    If StringLeft($as_Body[$i_Count], 1) = "." Then $as_Body[$i_Count] = "." & $as_Body[$i_Count]

    If _SmtpSend ($v_Socket, $as_Body[$i_Count] & @CRLF, "", $b_trace) Then
    SetError(500 + $i_Count)
    Return 0
    EndIf
    Next

    ; close the smtp session
    $i_Count = UBound($s_Send) - 1
    If _SmtpSend ($v_Socket, $s_Send[$i_Count], $s_ReplyCode[$i_Count], $b_trace) Then
    SetError(5000)
    Return 0
    EndIf

    TCPCloseSocket($v_Socket)
    TCPShutdown()
    Return 1
    EndFunc ;==>_INetSmtpMailAuth


    ;===============================================================================
    ;
    ; Function Name: _Base64Encoding()
    ; Description: Kodiert eine Zeichenfolge mit dem Base64-Verfahren
    ; (http://de.wikipedia.org/wiki/Base64)
    ; Parameter(s): $String - Zeichenfolge die kodiert werden soll
    ; Requirement(s): None
    ; Return Value(s): Kodierte Zeichenfolge
    ; Authors: bernd670
    ;
    ;===============================================================================
    Func _Base64Encoding($String)

    $strUmsetzung = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
    $strRetValue = ""

    For $i = 1 To StringLen($String) Step 3
    $strTok = StringMid($String, $i, 3)
    Switch StringLen($strTok)
    Case 3
    $iTokVal = (Asc(StringMid($strTok, 1, 1)) * 256 + _
    Asc(StringMid($strTok, 2, 1))) * 256 + _
    Asc(StringMid($strTok, 3, 1))
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1)
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $strRetValue &= $strTokCryt

    Case 2
    $iTokVal = (Asc(StringMid($strTok, 1, 1)) * 256 + _
    Asc(StringMid($strTok, 2, 1))) * 256
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1)
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $strRetValue &= $strTokCryt & "="

    Case 1
    $iTokVal = Asc(StringMid($strTok, 1, 1)) * 65536
    $iTokVal = BitShift($iTokVal, 12)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1)
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $strRetValue &= $strTokCryt & "=="

    EndSwitch
    Next

    Return $strRetValue
    EndFunc ;==>_Base64Encoding

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

    Einmal editiert, zuletzt von Julzk (16. Juli 2007 um 09:32)

  • hi

    also hab mir bei gmx nen email account extra für mein script gemacht,
    dann habe ich dieses nette script oben von bernd genommen und wollte eine test mail verschicken, allerdings bekomme ich die fehlermeldung

    @error = 4
    also: @ERROR = 4 - Unable to create socket

    aber ich habe keine ahnung woran das liegt...

    ihr vllt? ^^

    Spoiler anzeigen
    [autoit]


    func sendmail()
    $s_SmtpServer = "mail.gmx.net"
    $s_FromName ="gui"
    $s_FromAddress = @computername
    $s_ToAddress = "xyz@gmx.de"
    $s_Username = "user"
    $s_Passwd = "pswd"
    $s_Subject = "report"
    $as_Body = GUICtrlRead($emailmsg)
    $s_helo = ""
    $s_first = "-1"
    $b_trace = 0
    _INetSmtpMailAuth($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Username, $s_Passwd, $s_Subject, $as_Body,$s_helo, $s_first = "-1", $b_trace = 0)

    msgbox(0,"error",@error)


    EndFunc

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

    wär echt geil wenn das klappen würd!

    • Offizieller Beitrag

    Hallo,

    @error = 4, kommt immer wenn es probleme gibt auf den Mail-Server zuzugreifen, ist vllt. der Port 25 durch eine Firewall geblockt (s.o.) ?

    Es sind aber noch 2 Fehler in deiner Funktion:

    [list=1]
    [*]$s_FromAddress muss eine gültige Email-Adresse sein, in deinem Fall die die Du für dein Script erstellt hast.
    [*]$as_Body muss ein Array sein, sonst wird kein Text in die Email geschrieben!

    [autoit]


    Dim $as_Body[1]
    $as_Body[0] = GUICtrlRead($emailmsg)

    [/autoit]


    [/list=1]

    Sorry für die verspätete Anwort!

  • klar die email existiert auch ^^ habs nur hier für das forum raus genommen


    ok hab das mit der array geändert, funktioniert dennoch nicht ;)

    port 25 ist frei, absolut sicher ;)

    noch ne möglichkeit worans liegen könnt?

  • An dem hier?

    [autoit]

    $s_FromAddress = @computername

    [/autoit]


    Hier muss eine gültige Email stehen

    Zitat

    $s_FromAddress muss eine gültige Email-Adresse sein, in deinem Fall die die Du für dein Script erstellt hast.

  • $from pc auch? dachte das ist nur dazu da, den absender zu kennzeichnen,

    wie soll das denn in einem gültigen script funzen=?

    $fromadress = $toadress ? also das man sich selbst was schickt?

    EDIT
    geht auch nicht,

    und ja die adresse gibt es xD

    bei gmx

    Einmal editiert, zuletzt von azunai (20. November 2007 um 15:44)

  • Hallo liebe AutoIt Community erstmal :)

    Ich wollte gerade diese Udf hier ausprobieren, und hab das ganz schnell in eine Gui gefasst, allerdings funktioniert garnichts.. ;(
    Ist der service nicht mehr benutzbar?!

    Hier ist mein code:

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

    #include<Inet.au3>
    #include<GUIConstantsEx.au3>

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

    $GUI = GUICreate("Email Senden", 500, 300, -1, -1)

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

    #include <INet.au3>
    #include <GUIConstants.au3>

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

    GUICreate ("Mail", 400,300)

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

    GUISetState (@SW_SHOW)

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

    $Smtp = GUICtrlCreateInput ("Smtpserver",40,43)

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

    $Absender = GUICtrlCreateInput ("Von E-mail:",40,73)

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

    $Empfaenger = GUICtrlCreateInput ("An welche E-mail:",40,103)

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

    $Betreff = GUICtrlCreateInput ("Betreff:",40,133)

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

    $text = GUICtrlCreateInput ("Nachricht",40,163)

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

    $Username = GUICtrlCreateInput ("Username",40,193)

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

    $Passwort = GUICtrlCreateInput ("Passwort",40,223)

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

    $Button= GUICtrlCreateButton ("Send", 220, 260, 50)

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

    ; Deine Einstellungen!

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

    $s_SmtpServer = GUICtrlRead($Smtp)
    $s_FromName = @UserName
    $s_FromAddress = GUICtrlRead($Absender)
    $s_ToAddress = GUICtrlRead($Empfaenger)
    $s_Subject = GUICtrlRead($Betreff)
    $s_UName = GUICtrlRead($Username)
    $s_PWD = GUICtrlRead($Passwort)

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

    While 1
    $msg = GUIGetMsg()

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

    Select

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

    Case $Msg = $GUI_EVENT_CLOSE
    Exit

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

    Case $Msg = $Button

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

    Dim $as_Body[1]
    $as_Body[0] = GUICtrlRead($text)

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

    $Response = _INetSmtpMailAuth($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_UName, $s_PWD, $s_Subject , $as_Body )

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

    $err = @error
    If $Response = 1 Then
    MsgBox(0, "Success!", "Mail sent")
    Else
    MsgBox(0, "Error!", "Mail failed with error code " & $err)
    EndIf

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

    EndSelect

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

    WEnd

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

    ;===============================================================================
    ;
    ; Function Name: _INetSmtpMailAuth()
    ; Description: Sends an email using SMTP over TCP IP.
    ; Parameter(s): $s_SmtpServer - SMTP server to be used for sending email
    ; $s_FromName - Name of sender
    ; $s_FromAddress - eMail address of sender
    ; $s_ToAddress - Address that email is to be sent to
    ; $s_Username - Username for Authentication (bernd670)
    ; $s_Passwd - Password for Authentication (bernd670)
    ; $s_Subject - Subject of eMail
    ; $as_Body - Single dimension array containing the body of eMail as strings
    ; $s_helo - Helo identifier (default @COMPUTERNAME) sometime needed by smtp server
    ; $s_first - send before Helo identifier (default @CRLF) sometime needed by smtp server
    ; $b_trace - trace on a splash window (default 0 = no trace)
    ; Requirement(s): None
    ; Return Value(s): On Success - Returns 1
    ; On Failure - 0 and sets
    ; @ERROR = 1 - Invalid Parameters
    ; @ERROR = 2 - Unable to start TCP
    ; @ERROR = 3 - Unable to resolve IP
    ; @ERROR = 4 - Unable to create socket
    ; @ERROR = 5x - Cannot open SMTP session
    ; @ERROR = 50x - Cannot send body
    ; @ERROR = 5000 - Cannot close SMTP session
    ; Authors: Original function to send email via TCP - Asimzameer
    ; Conversion to UDF - Walkabout
    ; Correction Helo, timeout, trace - Jpm
    ; Correction send before Helo - Jpm
    ; Include Authentication - bernd670
    ;
    ;===============================================================================
    Func _INetSmtpMailAuth($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Username, $s_Passwd, $s_Subject = "", $as_Body = "", $s_helo = "", $s_first = "-1", $b_trace = 0)

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

    Local $v_Socket
    Local $s_IPAddress
    Local $i_Count
    Local $s_Send[9]
    Local $s_ReplyCode[9];Return code from SMTP server indicating success

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

    If $s_SmtpServer = "" Or $s_FromAddress = "" Or $s_ToAddress = "" Or $s_Username = "" Or $s_Passwd = "" Or $s_FromName = "" Or StringLen($s_FromName) > 256 Then
    SetError(1)
    Return 0
    EndIf
    If $s_helo = "" Then $s_helo = @ComputerName
    If TCPStartup() = 0 Then
    SetError(2)
    Return 0
    EndIf
    StringRegExp($s_SmtpServer, "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)")
    If @extended Then
    $s_IPAddress = $s_SmtpServer
    Else
    $s_IPAddress = TCPNameToIP($s_SmtpServer)
    EndIf
    If $s_IPAddress = "" Then
    TCPShutdown()
    SetError(3)
    Return 0
    EndIf
    $v_Socket = TCPConnect($s_IPAddress, 25)
    If $v_Socket = -1 Then
    TCPShutdown()
    SetError(4)
    Return (0)
    EndIf

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

    $s_Send[0] = "EHLO " & $s_helo & @CRLF
    ;~ If StringLeft($s_helo,5) <> "EHLO " Then $s_Send[0] = "EHLO " & $s_helo & @CRLF
    $s_ReplyCode[0] = "250"

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

    $s_Send[1] = "AUTH LOGIN" & @CRLF
    $s_ReplyCode[1] = "334"
    $s_Send[2] = _Base64Encoding($s_Username) & @CRLF
    $s_ReplyCode[2] = "334"
    $s_Send[3] = _Base64Encoding($s_Passwd) & @CRLF
    $s_ReplyCode[3] = "235"
    $s_Send[4] = "MAIL FROM: <" & $s_FromAddress & ">" & @CRLF
    $s_ReplyCode[4] = "250"
    $s_Send[5] = "RCPT TO: <" & $s_ToAddress & ">" & @CRLF
    $s_ReplyCode[5] = "250"
    $s_Send[6] = "DATA" & @CRLF
    $s_ReplyCode[6] = "354"

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

    $s_Send[7] = "From: " & $s_FromName & " <" & $s_FromAddress & ">" & @CRLF & _
    "To: " & "<" & $s_ToAddress & ">" & @CRLF & _
    "Subject: " & $s_Subject & @CRLF & _
    "Mime-Version: 1.0" & @CRLF & _
    "Content-Type: text/plain; charset=US-ASCII" & @CRLF & _
    @CRLF
    $s_ReplyCode[7] = ""

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

    $s_Send[8] = @CRLF & "." & @CRLF
    $s_ReplyCode[8] = "250"

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

    ; open stmp session
    If _SmtpSend($v_Socket, $s_Send[0], $s_ReplyCode[0], $b_trace, "220", $s_first) Then
    SetError(50)
    Return 0
    EndIf

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

    ; send header
    For $i_Count = 0 To UBound($s_Send) - 2
    If _SmtpSend($v_Socket, $s_Send[$i_Count], $s_ReplyCode[$i_Count], $b_trace) Then
    SetError(50 + $i_Count)
    Return 0
    EndIf
    Next

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

    ; send body records (a record can be multiline : take care of a subline beginning with a dot should be ..)
    For $i_Count = 0 To UBound($as_Body) - 1
    ; correct line beginning with a dot
    If StringLeft($as_Body[$i_Count], 1) = "." Then $as_Body[$i_Count] = "." & $as_Body[$i_Count]

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

    If _SmtpSend($v_Socket, $as_Body[$i_Count] & @CRLF, "", $b_trace) Then
    SetError(500 + $i_Count)
    Return 0
    EndIf
    Next

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

    ; close the smtp session
    $i_Count = UBound($s_Send) - 1
    If _SmtpSend($v_Socket, $s_Send[$i_Count], $s_ReplyCode[$i_Count], $b_trace) Then
    SetError(5000)
    Return 0
    EndIf

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

    TCPCloseSocket($v_Socket)
    TCPShutdown()
    Return 1
    EndFunc ;==>_INetSmtpMailAuth

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

    ;===============================================================================
    ;
    ; Function Name: _Base64Encoding()
    ; Description: Kodiert eine Zeichenfolge mit dem Base64-Verfahren
    ; (http://de.wikipedia.org/wiki/Base64)
    ; Parameter(s): $String - Zeichenfolge die kodiert werden soll
    ; Requirement(s): None
    ; Return Value(s): Kodierte Zeichenfolge
    ; Authors: bernd670
    ;
    ;===============================================================================
    Func _Base64Encoding($String)

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

    $strUmsetzung = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
    $strRetValue = ""

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

    For $i = 1 To StringLen($String) Step 3
    $strTok = StringMid($String, $i, 3)
    Switch StringLen($strTok)
    Case 3
    $iTokVal = (Asc(StringMid($strTok, 1, 1)) * 256 + _
    Asc(StringMid($strTok, 2, 1))) * 256 + _
    Asc(StringMid($strTok, 3, 1))
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1)
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $strRetValue &= $strTokCryt

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

    Case 2
    $iTokVal = (Asc(StringMid($strTok, 1, 1)) * 256 + _
    Asc(StringMid($strTok, 2, 1))) * 256
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1)
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $strRetValue &= $strTokCryt & "="

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

    Case 1
    $iTokVal = Asc(StringMid($strTok, 1, 1)) * 65536
    $iTokVal = BitShift($iTokVal, 12)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1)
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $strRetValue &= $strTokCryt & "=="

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

    EndSwitch
    Next

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

    Return $strRetValue
    EndFunc ;==>_Base64Encoding

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

    Wend

    [/autoit]


    Wär echt toll wenn mir jemand helfen könnte !

    Gruß
    Toffmo