Jump to content

Input box (in gui) send to email?


Guest Beefteck
 Share

Recommended Posts

Guest Beefteck

Ok, well now that I am needing this soon (for a program) I have an e-mail and input script all working right, BUT! I still (i have no idea why) I can not get the input text from TWO diffrent input boxes to send in one msg. to an email!....

I need real help with, I think it can be done w/ vaiables or somthing like that but for the life of me i can not get this to work.

also if it is not too much trouble the body I kinda want to look like this (it is a regestration program)

===============

Subject

===============

Input Box 1

Input Box 2

Date (not really needed now but would be VERY usefull! :"> )

===============

Link to comment
Share on other sites

Guest Beefteck

Ok well here is where i run into a problem.... I get the email BUT all I get is:

User name is: 4 Password is: 5

Here is the code I am useing. If someone can fix it and test that would be great.... read below 4 one more comment (after code)

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


$GUI1 = GUICreate("TEST WINDOWS FOR REGESTRATION", 1024, 718, 0, 0)

;~ MAIN====MAIN=====MAIN====MAIN=====MAIN====MAIN=====MAIN====MAIN=====MAIN====MAIN=====MAIN====MAIN===
==

HotKeySet("{ESC}", "na")
HotKeySet("{ENTER}", "Emailx")

$a = "SMTP SERVER (ex. smtp.gmail.com)"
$b = "SENDER EMAIL"
$c = "SENDING EMAIL PASSWORD (email address used to send to email)"

;~ ----grabber----grabber----

$user = GUICtrlCreateInput("", 687, 353, 150, 19)

$pw = GUICtrlCreateInput("" , 687, 376, 150, 19, $ES_PASSWORD)

$email = String("User name is: "&$user&" Password is: "&$pw)



;~ EXTRA====EXTRA======EXTRA====EXTRA======EXTRA====EXTRA======EXTRA====EXTRA======EXTRA====EXTRA======
EXTRA=


GUISetState()


While 1


        $msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

WEnd

GUIDelete()

Func na()
    
EndFunc 

Func Emailx($d, $e, $f, $g)
$h = ObjCreate ("CDO.Message")
With $h
.Subject = "New regestration"
.Sender = "EMAIL"
.From = "Game Signup"
.To = "EMAIL ADDRESS"
.TextBody = $email
;.AddAttachment ("C:\Documents and Settings\myname\Desktop\files\file.txt");needs full path- optional
EndWith
With $h.Configuration.Fields
.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $a
.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $b
.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $c
.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 90
.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Update
EndWith
$h.Send
Return
EndFunc

Another final option is for it to some how to write a text file the I can send it though the email thing. If there is no way through the way above then I will try this way. Thanks so much

-Beefteck

Link to comment
Share on other sites

any ideas???

I have a script for the input and a separate script for processing the emails.

I write the input to an ini file using the iniwrite feature and then my email script reads the input data from the ini file using the iniread feature.

You can also if you wish encrypt the data written to the ini file and then de encrypt it when read by the email script

This is a typical read statement:

Global $text = (_StringEncrypt(0, IniRead(@scriptdir&"\inifiles\message.ini", "msgtext", "text", "Not Known"), "yourencryptionkey", 1))

This is a typical write statement:

$textini = (_StringEncrypt(1, GUICtrlRead($input), "yourencryptionkey", 1))

iniwrite(@ScriptDir&"\inifiles\message.ini", "msgtext", "text", $textini)

The encryption key can be any group of letters and numbers of your choice.

In your input script you can also have a button which launches the email script to send the email. With this strategy your emailer is simply kept as processor.

I also use the ini file to store the other email variables like To, From, Fom Name, Service Provider, User Name and User Password all of which can be changed using an Inputbox for each field.

With your problem I think that you need to use the GUICtrlRead($yourinput) statement to solve the issue with your string.

Cheers

Ant.

Edited by anixon
Link to comment
Share on other sites

Guest Beefteck

ok, well I guess the best way was for the email sript to send the text file created.

if someone can make a script that will have the input text saved to a text file then emailed that would be great...

-Beefteck

Link to comment
Share on other sites

  • Moderators

I can't believe you have gone on all these days, and haven't even posted a "working" piece of code. The snippet (if you can even call it that) you've provided is absolutely absurd.

No call to the function email.

As Shevilie has pointed out, yes you would need GUICtrlRead() to read the input controls, but you haven't even shown that you understand the function you are trying to use.

As far as sending txt attachments, the option is already available by Jdeb in the Example scripts forum.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...