Log Dateien an e-Mail senden

10/09/2011 13:47 iTim#1
Hey com !

Ich habe eine frage.Auf meinem Windows Server habe ich einen Minecraft Server.Durch ein Plug-In werden dort automatisch Logdateien erstellt. Ich möchte nun mithilfe von AutoIt das diese Logdatein automatisch ans iPhone/e-Mail gesendet werden.

Das ganze sollte automatisch sein,da ich ja wenn ich unterwegs bin keinen
zugriff auf den Server habe.


Wie bekomm ich das hin ?
10/09/2011 15:56 butter123#2
also ich glaube ich habe schonmal nach ner emailfunktion für autoit gesucht und ncihts gefunden. eine möglichkeit wäre es, eine batch datei zu erstellen, die dann die email versendet. guck dir dazu mal [Only registered and activated users can see links. Click Here To Register...] an. da steht das glaube ich ganz gut
10/09/2011 20:06 amnesi#3
PHP Code:
#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")
$Input1 GUICtrlCreateInput(""84012121)
$Input2 GUICtrlCreateInput(""2484012121)
$Label1 GUICtrlCreateLabel("Mail sever: Für www.web.de ist er smtp.web.de "81622917)
$Label2 GUICtrlCreateLabel("Name des Absenders"2481610517)
$Label3 GUICtrlCreateLabel("Absender email addresse"87212217)
$Input3 GUICtrlCreateInput(""89612121)
$Input4 GUICtrlCreateInput(""2489612121)
$Label4 GUICtrlCreateLabel("Empfänger email addresse"2487212817)
$Input5 GUICtrlCreateInput(""815212121)
$Label5 GUICtrlCreateLabel("Betreff"81283517)
$Label6 GUICtrlCreateLabel(" Text  "2481283417)
$Input6 GUICtrlCreateInput(""24815212121)
$Label7 GUICtrlCreateLabel("Nochmal Absender email"818412117)
$Input7 GUICtrlCreateInput(""820812121)
$Input8 GUICtrlCreateInput(""24820812121)
$Label8 GUICtrlCreateLabel("Passwort der Absender email"24818414017)
$Button1 GUICtrlCreateButton("Email versenden"152248100250)
$Button2 GUICtrlCreateButton("Abbrechen"31225675250)
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.number8)
    
$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 
Nicht von mir.
Hoffe ich habe geholfen :)
10/09/2011 20:31 butter123#4
1. man muss noch <file.au3> includen
2. in zeile 67 steht $ex, muss aber $x sein

bei der batchvariante hat man allerdings den vorteil, dass mein kein emailkonto extra benötigt.
10/09/2011 20:48 amnesi#5
aso^^ okay.
10/09/2011 20:50 butter123#6
dachte ich zumindest... aber ich such jetzt schon 20 min und find einfach cniht das richtige... ich guck mal weiter^^

edit: ist mir jz zu doof, hab keine lsut mehr zu suchen...^^ war mir eigentlich ziehmlich sicher, dass man mit einer batch relativ einfahc eine mail versenden kann... naja... wenn jemand was dazu findet bitte poasten :)
10/10/2011 11:35 iTim#7
Danke erstmal für die mühe euch beiden, allerdings
brauch ich etwas das automatisch die e-mail
sendet, da ich nicht dauerzugriff auf den Server habe.
10/10/2011 11:45 amnesi#8
Das war die Funktion.
Sorry aber du müsstest doch wohl in der Lage sein das zu
automatisieren.
Schick mir sonst ne PN oder add mich bei skype ich helfef dir sonst gern^^
10/10/2011 18:44 iTim#9
Habs jetzt anders & mit ner udf gemacht..trotzdem danke
10/10/2011 19:51 amnesi#10
Das ist eine UDF...
Mit Beispiel
10/10/2011 22:11 butter123#11
kannst du die udf hier posten? interessiert mcih ja auch^^
10/11/2011 13:24 iTim#12
a
10/11/2011 13:43 amnesi#13
Du weist schon das, dass genau die gleiche Funktion ist
wie die, welche ich gepostet habe ? :S
10/11/2011 13:52 klavier22#14
*OFFTOPIC* Lachanfall :D */OFFTOPIC*

Wenn du dir das, was amnesi vorher gepostet hat mal genau anschaust - bedeutet auch mal runterscrollst - besteht da nicht eine verblüffende Ähnlichkeit?

Außerdem: Warum fragst du erst in einem Forum, um dann zu posten, dass du die Antwort bei Google gefunden hast?
10/11/2011 14:02 iTim#15
ja aber mit der hats geklappt & mit der anderen nicht fertig

ich habe gefragt wie man es macht, dann kam mir die idee das es dazu bestimmt
ne udf gibt und hab sie dann gefunden.