Ups, entschuldigung.
Ich verwende "_INetSmtpMailCom".
Beiträge von Arah
-
-
-
Hallo liebe AutoIT Gemeinde,
ich frage mich gerade, wie ich eine Datei an eine E-Mail automatisch senden kann (soll durch einem Button erfolgen), sprich wenn ich drauf klicke, dass von meinem Desktop eine Datei direkt an die E-Mail meines Freundes gesendet wird.
Ich hoffe ihr wisst eine Lösung -
-
hmm
(24) : ==> Variable used without being declared.:
ClipPut($array[$iCount])
ClipPut(^ ERRORC
Alles anzeigen#include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> $Form1 = GUICreate(".", 265, 111, 463, 264) $Button1 = GUICtrlCreateButton("Klick", 48, 16, 169, 73) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit local $array=["123","456","789"],$iCount=0 Case $Button1 ClipPut($array[$iCount]) $iCount+=1 if $iCount>ubound($array)-1 then $iCount=0 endif EndSwitch WEnd
-
Vielen Dank für die schnellen Antworten, funktionert 1 A!
Doch wie der ganze Spaß bei 3 ClipPut's aus?
C
Alles anzeigen#include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate(".", 265, 111, 463, 264) $Button1 = GUICtrlCreateButton("In Zwischenablage", 48, 16, 169, 73) GUISetState(@SW_SHOW) $i = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $i = Not $i ;alternierend 1,0,1,0,1,0.... If $i Then ;wenn 1 ClipPut("123") GUICtrlSetData($Button1, "456") ;Buttontext Else ;wenn 0 ClipPut("456") GUICtrlSetData($Button1, "123") ;Buttontext Else ClipPut("789") GUICtrlSetData($Button1, "123") ;Buttontext EndIf EndSwitch WEnd
funktioniert nicht ganzund gibt es eine Möglichkeit, dass sich die Bezeichnung / Name des Buttons nicht ändert?^^
-
Moin AutoIT Gemeinde!
Ich habe folgendes Problem: Ich möchte ein Scrypt erstellen, bei dem jedesmal wenn ich den Button klicke ein bestimmter Text in meine Zwischenablage kopiert wird. Dies habe ich auch hinbekommen, nur wie schaffe ich es, dass beim 1. Klick der Text "123" und beim 2. mal klicken des Buttons der Text "456" erscheint?
C
Alles anzeigen#include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate(".", 265, 111, 463, 264) $Button1 = GUICtrlCreateButton("..", 48, 16, 169, 73) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 ClipPut("123") ; //// ClipPut("456") EndSwitch WEnd
-
Selbst wenn ich den 1:1 kopierten Quellcode ausführe erhalte ich diesen Fehler (auf mehreren Systemen getestet)
-
Genau so habe ich es mir vorgestellt, danke!
kennst du noch irgend eine möglichkeit alle Fehlermeldungen (MsgBox) auszublenden / zu deaktivieren? Denn jedes mal wenn ich mein Script starte bekomme ich den Error Code:2
habe es schon mit einen einfachen "send ("{Space}")" Befehl versucht, der wollte aber nicht ganz so funktionieren...
-
Eine Frage habe ich nun doch noch
wie sieht das ganze bei 2 Inputboxen aus?C
Alles anzeigen#include <GUIConstantsEx.au3> #include <_INetSmtpMailCom.au3> $Form1 = GUICreate("E-Mail senden", 301, 161, 191, 123) $Input1 = GUICtrlCreateInput("Text1", 8, 8, 273, 21) $Input2 = GUICtrlCreateInput("Text2", 8, 58, 273, 21) $Button1 = GUICtrlCreateButton("Senden!", 56, 128, 171, 25) GUISetState(@SW_SHOW) $SmtpServer = "mail.ok.de" $FromName = "Email" $FromAddress = "xxx@ok.de" $ToAddress = "xxx@ok.de" $Subject = "Betreff Test" $username = "xxxx@ok.de" $Password = "xxx" $IPPort = 587 $ssl = 1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $Body = GUICtrlRead($Input1) $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $username, $Password, $IPPort, $ssl) If @error Then MsgBox(0, "", "Fehler") Else MsgBox(0, "", "OK") EndIf EndSwitch WEnd
-
Danke vielmals für deine stundenlange Bemühung
mit ok.de läuft es hervorragend.
bei web.de sieht es hingegen schlecht aus
benutze folgende Einstellungen für Web.de:$SmtpServer = "smtp.web.de"
$IPPort = 587
$ssl = 0 -
Obwohl ich wieder den Error code:2 erhalten habe, hat es dieses mal geklappt!
Ich werde es gleich mal mit web.de versuchen
-
$oMyRet[2] entfernt + firewall ausgeschaltet, erhalte immer noch die Fehlermeldungen. Ich würde es mal gerne mit meinem gmx Konto versuchen, wie lautet dort der SmtpServer, IPPort, ssl?
-
Ich erhalte die MsgBox mit "Fehler" und direkt wenn ich das Script startet erhalte ich auch direkt eine MsgBox mit den Error code:2
Verändert habe ich nur die ganzen Adressen, Passwort, etc.C
Alles anzeigen#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <INet.au3> #include <_INetSmtpMailCom.au3> $Form1 = GUICreate("E-Mail senden", 301, 161, 191, 123) $Input1 = GUICtrlCreateInput("Text", 8, 8, 273, 21) $Button1 = GUICtrlCreateButton("Senden!", 56, 128, 171, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Global $oMyRet[2] $SmtpServer = "smtp.web.de" $FromName = "Mail Test" $FromAddress = "j*****@web.de" $ToAddress = "j*****@web.de" $Subject = "Betreff Test" $AttachFiles = "" $CcAddress = "" $BccAddress = "" $Importance = "Normal" $username = "j*******@web.de" $Password = "a**********" $IPPort = 587 $ssl = 0 $Body = GUICtrlRead($Input1) $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $username, $Password, $IPPort, $ssl) If @error Then MsgBox(0, "", "Fehler") Else MsgBox(0, "", "OK") EndIf EndSwitch WEnd
-
Das Einfügen der _INetSmtpMailCom.au3 hat geklappt. Nun startet das Script auch, jedoch bekomme ich kurz nach dem Starten diese Fehlermeldung:
Error code:2 Description: Der Transport konnte keine Verbindung zum Server herstellen. -
Vielen Danke für deine Antwort!
Dein Code ist für mich gut überschaubar und leicht zu verstehen als Anfänger
Jedoch besteht noch folgendes Problem: wo kann ich mir die "_INetSmtpMailCom.au3" herunterladen / wo & füge ich diese ein.edit: Habe soeben die "_INetSmtpMailCom.au" vom Post #2 in meinem include Ordner kopiert. Nun startet das Script. Bekomme aber immer folgende Fehlermeldung: "### COM Error ! Number: 80020009 ScriptLine: 91 Description:Der Server hat die Absenderadresse zurückgewiesen. Die Serverantwort lautet: 530 Must issue a STARTTLS command first"
-
Ich habe mir mal aus Spaß folgenden Script aus dem Internet kopiert, selbst dort erhalten ich den Fehler
C
Alles anzeigen#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Email versender", 396, 294, 1153, 185) $Input1 = GUICtrlCreateInput("", 8, 40, 121, 21) $Input2 = GUICtrlCreateInput("", 248, 40, 121, 21) $Label1 = GUICtrlCreateLabel("Mail sever: Für www.web.de ist er smtp.web.de ", 8, 16, 229, 17) $Label2 = GUICtrlCreateLabel("Name des Absenders", 248, 16, 105, 17) $Label3 = GUICtrlCreateLabel("Absender email addresse", 8, 72, 122, 17) $Input3 = GUICtrlCreateInput("", 8, 96, 121, 21) $Input4 = GUICtrlCreateInput("", 248, 96, 121, 21) $Label4 = GUICtrlCreateLabel("Empfänger email addresse", 248, 72, 128, 17) $Input5 = GUICtrlCreateInput("", 8, 152, 121, 21) $Label5 = GUICtrlCreateLabel("Betreff", 8, 128, 35, 17) $Label6 = GUICtrlCreateLabel(" Text ", 248, 128, 34, 17) $Input6 = GUICtrlCreateInput("", 248, 152, 121, 21) $Label7 = GUICtrlCreateLabel("Nochmal Absender email", 8, 184, 121, 17) $Input7 = GUICtrlCreateInput("", 8, 208, 121, 21) $Input8 = GUICtrlCreateInput("", 248, 208, 121, 21) $Label8 = GUICtrlCreateLabel("Passwort der Absender email", 248, 184, 140, 17) $Button1 = GUICtrlCreateButton("Email versenden", 152, 248, 100, 25, 0) $Button2 = GUICtrlCreateButton("Abbrechen", 312, 256, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $rc = _INetSmtpMailCom(GUICtrlRead( $Input1),GUICtrlRead($Input2),GUICtrlRead($Input3), GUICtrlRead($Input4), GUICtrlRead($Input5), GUICtrlRead($Input6), "", "","", GUICtrlRead($Input7), GUICtrlRead($Input8)) If @error then msgbox(0,"Error sending message","Error code:" & @error & " Description:" & $rc) EndIf Case $Button2 Exit EndSwitch WEnd Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "") $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.Cc = $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 $ex = 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") = 25 ;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 ;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
-
Nun erhalte ich folgende Fehlermeldung:
"Error code:2 Discription:Der Transport konnte keine Verbindung zum Server herstellen." -
Code
Alles anzeigen$SmtpServer = "smtp.web.de" ; address for the smtp-server to use - REQUIRED $FromName = "Name" ; name from who the email was sent $FromAddress = "x@web.de" ; address from where the mail should come $ToAddress = "x@web.de" ; destination address of the email - REQUIRED $Subject = "Betreff" ; subject from the email - can be anything you want it to be $Body = "Test123" ; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - 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 = "x@web.de" ; username for the account used from where the mail gets sent - REQUIRED $Password = "xPW" ; password for the account used from where the mail gets sent - REQUIRED $IPPort = 587 ; port used for sending the mail $ssl = 1 ; enables/disables secure socket layer sending - put to 1 if using httpS
-
$ssl = 1 und $ssl = 0 probiert, erhalte aber trotzdem die Fehlermeldung.