Sign in to follow this  
Followers 0
robzhei

Send form by E-mail

5 posts in this topic

Im working on a script that need to send info from a form directly,

What i dont get is how i get the filled in form to get on each row in the mail

Here is my code :

#include <GUIConstants.au3>

GUICreate("Email form sender test)",320,180)

GUICtrlCreateInput("Type text here to be sent", 20, 40, 110, 20)
GUICtrlCreateInput("Type text here to be sent", 20, 70, 110, 20)

$button1 = GUICtrlCreateButton ("GO!", 180,100,120,40)

GUISetState()

; Run the GUI until the dialog is closed
while 1
    $msg = GUIGetMsg() 
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

GUIDelete()

How do i insert the _INetSmtpMail in this code so the info gets on row1 and row2 in the mail ?

(already rtfm, but im such a n00b , sry)

Please help

//Rob

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

GuiCreate("MyGUI", 392, 439,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

GuiCtrlCreateGroup("From name", 20, 20, 350, 50)
$s_FromName = GuiCtrlCreateInput("", 30, 40, 330, 20)
GuiCtrlCreateGroup("From address", 20, 80, 350, 50)
$s_FromAddress = GuiCtrlCreateInput("", 30, 100, 330, 20)
GuiCtrlCreateGroup("To adress", 20, 140, 350, 50)
$s_ToAddress = GuiCtrlCreateInput("", 30, 160, 330, 20)
GuiCtrlCreateGroup("Subject", 20, 200, 350, 50)
$Subject = GuiCtrlCreateInput("", 30, 220, 330, 20)
GuiCtrlCreateGroup("Body", 20, 260, 350, 110)
$Body = GuiCtrlCreateEdit("", 30, 280, 330, 80)
$Button1 = GuiCtrlCreateButton("GO!!!", 20, 380, 350, 30)

GuiSetState()
While 1
    $msg = GUIGetMsg()
    Select  
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $button1
            $mail = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $Subject, $Body) ; Change $s_SmtpServer to the Smtp server of your choice.
    EndSelect
WEnd

If $mail = 1 Then
    ; Do something if it _INetmail is succesful
Else
    ; Something went wrong
EndIf

was that what you were asking for?

Edited by rrrm99

Share this post


Link to post
Share on other sites

Thanx for the fast reply :whistle:

But no, thats not at all what im looking for, If u open my script i think u will get the picture

Only the text typed in the two Rows shall be in the body of the mail,

all other mailinfo will be fixed (to, from, subject and so on)

So simply, type text in the boxes, press GO!, and its done :lmao:

Share this post


Link to post
Share on other sites

Thanx for the fast reply :whistle:

But no, thats not at all what im looking for, If u open my script i think u will get the picture

Only the text typed in the two Rows shall be in the body of the mail,

all other mailinfo will be fixed (to, from, subject and so on)

So simply, type text in the boxes, press GO!, and its done :lmao:

have a look at GUIctrlcreateedit() in the help file...it can replace any amount of Guictrlcreateinput 's

i will leave it to you to code it ;)

Share this post


Link to post
Share on other sites

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

$SmtpServer = '10.10.10.200' ; Change $SmtpServer to the Smtp server of your choice.

GuiCreate("MyGUI", 392, 439,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

GuiCtrlCreateGroup("From name", 20, 20, 350, 50)
$FromName = GuiCtrlCreateInput("", 30, 40, 330, 20)
GuiCtrlCreateGroup("From address", 20, 80, 350, 50)
$FromAddress = GuiCtrlCreateInput("", 30, 100, 330, 20)
GuiCtrlCreateGroup("To adress", 20, 140, 350, 50)
$ToAddress = GuiCtrlCreateInput("", 30, 160, 330, 20)
GuiCtrlCreateGroup("Subject", 20, 200, 350, 50)
$Subject = GuiCtrlCreateInput("", 30, 220, 330, 20)
GuiCtrlCreateGroup("Body", 20, 260, 350, 110)
$Body = GuiCtrlCreateEdit("", 30, 280, 330, 80)
$Button1 = GuiCtrlCreateButton("GO!!!", 20, 380, 350, 30)

GuiSetState()
While 1
    $msg = GUIGetMsg()
    Select  
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $button1
            $FromName1 = GUICtrlRead($FromName)
            $FromAddress1 = GUICtrlRead($FromAddress)
            $ToAddress1 = GUICtrlRead($ToAddress)
            $Subject1 = GUICtrlRead($Subject)
            $Body1 = GUICtrlRead($Body)
            $mail = _INetSmtpMail($SmtpServer, $FromName1, $FromAddress1, $ToAddress1, $Subject1, $Body1) 
    EndSelect
WEnd

If $mail = 1 Then
    ; Do something if it _INetmail is succesful
Else
    ; Something went wrong
EndIf

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0