Hallo ich möchte eine art "Report" funktion bauen das user einen text in eine box schreiben kann und das dann per mail an meine gmx andresse geschikt wird...
Hab auch schon den code aus Klick oribert aber steige da nicht durch....
MfG Brokolie
Hallo ich möchte eine art "Report" funktion bauen das user einen text in eine box schreiben kann und das dann per mail an meine gmx andresse geschikt wird...
Hab auch schon den code aus Klick oribert aber steige da nicht durch....
MfG Brokolie
guckstu hier:
https://autoit.de/index.php?page…1277#post111277
wo genau liegt denn dein "problem" wo du nich durchblickst?
ich kapier nicht wie ich diesen code in meine bereits vorhanden anwendung impeltiere
[autoit]#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#NoTrayIcon
#Region ### START Koda GUI section ### Form=C:\Users\Brokolie\Desktop\verschiedenes\AutoIt\GUI\GUI'S\SceneLexicon.kxf
$SceneLexicon = GUICreate("SceneLexicon by Brokolie", 381, 104, 192, 124, BitOR($WS_POPUP, $WS_CLIPSIBLINGS))
GUISetBkColor(0x000000)
$wort = GUICtrlCreateInput("Lexicon", 40, 48, 145, 21, BitOR($ES_CENTER, $ES_AUTOHSCROLL))
GUICtrlSetColor(-1, 0x0080FF)
$Start = GUICtrlCreateButton("Start", 216, 8, 113, 33, 0)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0080FF)
GUICtrlSetBkColor(-1, 0x646464)
$Close = GUICtrlCreateButton("Close", 216, 48, 113, 33, 0)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0080FF)
GUICtrlSetBkColor(-1, 0x696969)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0080FF)
GUISetState(@SW_SHOW)
$Report = GUICtrlCreateButton("Report", 96, 72, 65, 25, 0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0080FF)
GUICtrlSetBkColor(-1, 0x696969)
$Pic = GUICtrlCreatePic(@ScriptDir & "\bg.jpg", 0, 0, 381, 104)
GUICtrlSetBkColor(-1, 0x646464)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Close
_exit()
Case $Start
_Check()
Case $Report
_report()
EndSwitch
WEnd
Func _Check()
$read = GUICtrlRead($wort)
$answer = IniRead("Lexicon.ini", "Words", $read, "")
If $answer <> "" Then MsgBox(64, "Lösung", $answer)
EndFunc ;==>_Check
Func _exit()
MsgBox (64, "SceneLexicon","Vielen dank das Sie SceneLexicon von Brokolie und L1ght genutzt haben! Bitte besuchen sie HBA-Crew.biz")
Exit
EndFunc
Func _report()
$report = GUICreate("Report", 381, 104, 192, 124, BitOR($WS_POPUP, $WS_CLIPSIBLINGS))
GUISetBkColor(0x000000)
$mail = GUICtrlCreateInput("Report", 40, 48, 145, 21, BitOR($ES_CENTER, $ES_AUTOHSCROLL))
GUICtrlSetColor(-1, 0x0080FF)
$send = GUICtrlCreateButton("Send", 216, 8, 113, 33, 0)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0080FF)
GUICtrlSetBkColor(-1, 0x646464)
$Close = GUICtrlCreateButton("Close", 216, 48, 113, 33, 0)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0080FF)
GUICtrlSetBkColor(-1, 0x696969)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0080FF)
GUISetState(@SW_SHOW)
$Pic = GUICtrlCreatePic(@ScriptDir & "\bg2.jpg", 0, 0, 381, 104)
GUICtrlSetBkColor(-1, 0x646464)
EndFunc
Nichts leichter als das:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Inet.au3>
#NoTrayIcon
#Region ### START Koda GUI section ### Form=C:\Users\Brokolie\Desktop\verschiedenes\AutoIt\GUI\GUI'S\SceneLexicon.kxf
$SceneLexicon = GUICreate("SceneLexicon by Brokolie", 381, 104, 192, 124, BitOR($WS_POPUP, $WS_CLIPSIBLINGS))
GUISetBkColor(0x000000)
$wort = GUICtrlCreateInput("Lexicon", 40, 48, 145, 21, BitOR($ES_CENTER, $ES_AUTOHSCROLL))
GUICtrlSetColor(-1, 0x0080FF)
$Start = GUICtrlCreateButton("Start", 216, 8, 113, 33, 0)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0080FF)
GUICtrlSetBkColor(-1, 0x646464)
$Close = GUICtrlCreateButton("Close", 216, 48, 113, 33, 0)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0080FF)
GUICtrlSetBkColor(-1, 0x696969)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0080FF)
$ReportButton = GUICtrlCreateButton("Report", 96, 72, 65, 25, 0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0080FF)
GUICtrlSetBkColor(-1, 0x696969)
$Pic = GUICtrlCreatePic(@ScriptDir & "\bg.jpg", 0, 0, 381, 104)
GUICtrlSetBkColor(-1, 0x646464)
#EndRegion ### END Koda GUI section ###
[/autoit] [autoit][/autoit] [autoit]#Region Report-GUI
$reportGUI = GUICreate("Report", 381, 104, 192, 124, BitOR($WS_POPUP, $WS_CLIPSIBLINGS))
GUISetBkColor(0x000000)
$mail = GUICtrlCreateInput("Report", 40, 48, 145, 21, BitOR($ES_CENTER, $ES_AUTOHSCROLL))
GUICtrlSetColor(-1, 0x0080FF)
$send = GUICtrlCreateButton("Send", 216, 8, 113, 33, 0)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0080FF)
GUICtrlSetBkColor(-1, 0x646464)
$CloseReport = GUICtrlCreateButton("Close", 216, 48, 113, 33, 0)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0080FF)
GUICtrlSetBkColor(-1, 0x696969)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0080FF)
$PicReport = GUICtrlCreatePic(@ScriptDir & "\bg2.jpg", 0, 0, 381, 104)
GUICtrlSetBkColor(-1, 0x646464)
#EndRegion
GUISwitch($SceneLexicon) ; wieder auf die erste GUI wechseln.
GUISetState(@SW_SHOW,$SceneLexicon)
While 1
$nMsg = GUIGetMsg(1)
Switch $nMsg[1] ;fragt das fenster ab, von welchem die Aktion kam
Case $SceneLexicon ; Falls das Fenster $SceneLexicon war, dann...
Switch $nMsg[0] ; fragt die Aktion ab
Case $Close
_exit()
Case $Start
_Check()
Case $ReportButton
_report()
EndSwitch
Case $reportGUI ; falls es die reportGUI war...
Switch $nMsg[0]
Case $CloseReport
GUISetState(@SW_HIDE,$reportGUI)
Case $send
_Sendmail()
EndSwitch
EndSwitch
WEnd
Func _Check()
$read = GUICtrlRead($wort)
$answer = IniRead("Lexicon.ini", "Words", $read, "")
If $answer <> "" Then MsgBox(64, "Lösung", $answer)
EndFunc ;==>_Check
Func _exit()
MsgBox (64, "SceneLexicon","Vielen dank das Sie SceneLexicon von Brokolie und L1ght genutzt haben! Bitte besuchen sie HBA-Crew.biz")
Exit
EndFunc
Func _report()
GUISetState(@SW_SHOW,$reportGUI)
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func _Sendmail()
$s_SmtpServer = "mail.gmx.net" ; <- hier der smtp server, über den du senden möchtest
$s_FromName = "xxx" ;<- hier der Name, der als absender angezeigt werden soll
$s_FromAddress = "xxx@gmx.de" ;<- Hier die email des absenders ( muss gültig sein! . "miau" geht nicht. Es müsste schon [email='miau@miaukopf.de'][/email] sein.)
$s_ToAddress = "XXX" ; <- der Empfänger der email
$s_Subject = "My Test UDF" ; <- Betreff
$s_UName = "xxx@gmx.de" ; Username, mit dem du dich auf dem smtp server anmeldest
$s_PWD = "xxx" ; <- und das dazugehörige passwort
Dim $as_Body[2]
$as_Body[0] = "Hier dein Text"
$as_Body[1] = "Natürlich gehen auch mehrere Zeilen. Aber es muss in einem Array sein!"
; Soll die Mail mehr oder wniger zeilen enthalten musst du die grköße des Arrays ändern
; Dim $as_Body[3] statt [2]
; und natürlich die extra zeile anhängen:
; $as_Body[2] = "das wäre dann Zeile 3"
$Response = _INetSmtpMailAuth($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_UName, $s_PWD, $s_Subject, $as_Body)
$err = @error
If $Response = 1 Then
MsgBox(0, "Success!", "Mail sent")
Else
MsgBox(0, "Error!", "Mail failed with error code " & $err)
EndIf
EndFunc
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit];; DAS HIER UNVERÄNDERT LASSEN!
[/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)
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, 25)
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
eine bitte noch...
der text sonn die variable sein $mail sein^^
Sollte es eigentlich. Pass aber auf, wenn es über hotmail gesendet werden soll. Die smtp Server von denn benötigen SSL-Verschlüsselung, daher fällt dieser Anbieter dann weg. GMX klappt aber super - habe vor ca. einer woche noch erfolgreich getestet.