Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Processing User Input in HTML mailto - Newbie

Reply
Thread Tools

Processing User Input in HTML mailto - Newbie

 
 
M
Guest
Posts: n/a
 
      11-11-2006
Hi,

I have searched various news groups and i know i can use the mailto in
the way below by hardcoding what it should say. Is it possible without
using (asp or cgi) any scripting to pass the contents of user input in
text boxes into the subject and body field to send as an email????????


Yes this works but.....how do i pass user filled information into this
<form name "theform" action="MAILTO?subject=How do i
read info from subject text box and replace this with it&body=Any Help
will be appreciated"
method="post"
enctype="text/plain" >


Any help will be appreciated.
Thanks
M

 
Reply With Quote
 
 
 
 
Michael Fesser
Guest
Posts: n/a
 
      11-11-2006
..oO(M)

>I have searched various news groups and i know i can use the mailto in
>the way below by hardcoding what it should say.


You cannot use a 'mailto' in a form's action, because it's completely
undefined and will fail in many cases.

>Is it possible without
>using (asp or cgi) any scripting to pass the contents of user input in
>text boxes into the subject and body field to send as an email????????


Form processing always requires a server-side script.

Micha
 
Reply With Quote
 
 
 
 
Andrew Bailey
Guest
Posts: n/a
 
      11-12-2006

"Michael Fesser" <> wrote in message
news:...
> .oO(M)
>
>>I have searched various news groups and i know i can use the mailto in
>>the way below by hardcoding what it should say.

>
> You cannot use a 'mailto' in a form's action, because it's completely
> undefined and will fail in many cases.
>
>>Is it possible without
>>using (asp or cgi) any scripting to pass the contents of user input in
>>text boxes into the subject and body field to send as an email????????

>
> Form processing always requires a server-side script.
>
> Micha


Here ya go...

(Remember to scamble the mailto: and your domain name) Make an error and
success page too

Andy


<html>
<head>
<title>Transfer Form data to email client</title>

<script type="text/javascript">
<!-- TRANFER FORM TO EMAIL CLIENT
function sendmymail(){
var firstname= document.getElementById('first').value;
var lastname= document.getElementById('last').value;
var mysubject= document.getElementById('subject').value;
var myto=
document.getElementById('dept')[document.getElementById('dept').selectedIndex].value;
var mybody= document.getElementById('emailbody').value;
if (firstname==''){
parent.location="contact us error page.html";
} else if (lastname==''){
parent.location="contact us error page.html";
} else if (mysubject==''){
parent.location="contact us error page.html";
} else if (mybody==''){
parent.location="contact us error page.html";
} else {
document.location.href="mailto:"+ myto+"@yourdomian.com"?subject="+
mysubject +"&body="+ mybody +"%0D%0A%0D%0AFrom "+ firstname +" " + lastname;
parent.location="contact thankyou page.html";
}
}
// - End of JavaScript - -->
</script>

</head>
<body>

<form method="get" id="the id" name="myform">

Your First Name: <input type="text" name="first" id="first" maxlength="30">
<br>
Your Last Name: <input type="text" name="last" id="last" maxlength="30">
<br>
Subject: <input type="text" name="subject" id="subject" maxlength="60">
<br>
Department: <select name="dept" id="dept">
<option value="sales">Sales</option>
<option value="support">Support</option>
<option value="admin">Admin</option>
<option value="order">Order</option>
<option value="delivery">Delivery</option>
<option value="warranty">Warranty</option>
<option value="privacy">Privacy</option>
<option value="cancellation">Cancellation</option>
<option value="personnel">Personnel</option>
</select>
<br>
Your Message: <textarea cols="35" rows="9" name="emailbody"
id="emailbody"></textarea>
<br>
Submit: <input type="submit" value="Submit" name="Submit"
onclick="sendmymail();" title="Click here to SUBMIT your email">

</form>
</body>
</html>




 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      11-12-2006
Andrew Bailey wrote:
> "Michael Fesser" <> wrote in message
> news:...
>> .oO(M)
>>
>>> I have searched various news groups and i know i can use the mailto in
>>> the way below by hardcoding what it should say.

>> You cannot use a 'mailto' in a form's action, because it's completely
>> undefined and will fail in many cases.
>>
>>> Is it possible without
>>> using (asp or cgi) any scripting to pass the contents of user input in
>>> text boxes into the subject and body field to send as an email????????

>> Form processing always requires a server-side script.
>>
>> Micha

>
> Here ya go...
>
> (Remember to scamble the mailto: and your domain name) Make an error and
> success page too
>
> Andy
>
>
> <html>
> <head>
> <title>Transfer Form data to email client</title>
>
> <script type="text/javascript">
> <!-- TRANFER FORM TO EMAIL CLIENT
> function sendmymail(){
> var firstname= document.getElementById('first').value;


<snip the "good try" effort>

And what happens on a computer where no pop email accounts are setup,
i.e., hotmail or yahoo mail account only, eh?

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
Michael Fesser
Guest
Posts: n/a
 
      11-12-2006
..oO(Jonathan N. Little)

><snip the "good try" effort>
>
>And what happens on a computer where no pop email accounts are setup,
>i.e., hotmail or yahoo mail account only, eh?


Additionally it's invalid code.

Micha
 
Reply With Quote
 
M
Guest
Posts: n/a
 
      11-12-2006
Thats a good point, the user may not have a pop 3 account set up and
the java script did not work....

Any suggestions on how to do this form submission....???

I'm sure there are solutions out there in the user groups and obviously
im not looking in the right place....i would appreciate some useful
search tips and if you could also point me towards the right groups for
html....even better would be a solution....as ive been attempting this
form submission for ages :-<

Help me.....



Michael Fesser wrote:
> .oO(Jonathan N. Little)
>
> ><snip the "good try" effort>
> >
> >And what happens on a computer where no pop email accounts are setup,
> >i.e., hotmail or yahoo mail account only, eh?

>
> Additionally it's invalid code.
>
> Micha


 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      11-12-2006
M wrote:
> Thats a good point, the user may not have a pop 3 account set up and
> the java script did not work....
>
> Any suggestions on how to do this form submission....???


Yes, the proper way to use this is with a server-side script and does
not involve the sender's email client.

<form name "theform"
action="TheScriptOnMyServerThatSendAnEmailToMeDire ctly.php" ...

There are many out there, just search for ones that are *secure* and
cannot be used as spam relays... Others here may have some suggestions
for you...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
wayne
Guest
Posts: n/a
 
      11-16-2006
M wrote:
> Thats a good point, the user may not have a pop 3 account set up and
> the java script did not work....
>
> Any suggestions on how to do this form submission....???
>
> I'm sure there are solutions out there in the user groups and obviously
> im not looking in the right place....i would appreciate some useful
> search tips and if you could also point me towards the right groups for
> html....even better would be a solution....as ive been attempting this
> form submission for ages :-<
>
> Help me.....
>


I use a formmail from http://www.tectite.com/ and have had good success
with it. The file is quite large as all of the documentation is inside.
It is free and secure.

This is the code I use for the form:

<div id="content">
<h1>Contact Form</h1>
<p>Please fill in the blanks and click on "Submit." </p>
<hr />

<form method="post" action="http://your url here">
<input type="hidden" name="env_report"
value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUT H_TYPE,REMOTE_USER" />
<input type="hidden" name="recipients" value="your email_*_aol.com" />
<input type="hidden" name="bcc" value="another email_*_yahoo.com" />
<input type="hidden" name="required" value="email:Your email
address,firstname:First Name,lastname:Last Name" />
<input type="hidden" name="derive_fields"
value="realname=firstname+lastname" />
<input type="hidden" name="subject" value="Form Information" />

<fieldset>
<legend>Personal Information:</legend>
<label for="lastname">Please enter your last name:</label>
<input type="text" name="lastname" class="field" tabindex="1" />
<label for="firstname">Please enter your first name:</label>
<input type="text" name="firstname" class="field" tabindex="2" />
<label for="address">Please enter your address:</label>
<input type="text" name="address" class="field" tabindex="3" />
<label for="city">Please enter your city:</label>
<input type="text" name="city" class="field" tabindex="4" />
<label for="state">Please enter your state:</label>
<input type="text" name="state" class="field" tabindex="5" />
<label for="phone">Please enter your phone number:</label>
<input type="text" name="phone" class="field" tabindex="6" />
<label for="email">Please enter your email address:</label>
<input type="text" name="email" class="field" tabindex="7" />
</fieldset>

<fieldset>
<legend>Subject:</legend>
<label for="topic">Broken link</label>
<input type="radio" name="topic" value="Broken link" />
<label for="topic">Comment</label>
<input type="radio" name="topic" value="Comment" />
<label for="topic">Question</label>
<input type="radio" name="topic" value="Question" />
<label for="topic">Other</label>
<input type="radio" name="topic" value="Other" checked="checked" />
</fieldset>

<fieldset>
<legend>Please enter your message:</legend>
<textarea name="mesg" rows="10" cols="50"></textarea>
</fieldset>

<fieldset>
<input type="submit" value="Submit" class="button" /><input type="reset"
value="Reset" class="button" />
</fieldset>
</form>
<!--
Please support the ongoing development of FormMail and our other
freeware products by keeping the following text on your form
(or placing it elsewhere on your website). Thanks!
-->
<p class="copy">This form and its free
<a href="http://www.tectite.com/">FormMail</a>
processor supplied by www.tectite.com, creators of
software <a href="http://www.tectite.com/">copy protection</a>.
</p>
</div>

--
Wayne
http://www.glenmeadows.us
With or without religion, you would have good people doing good things
and evil people doing evil things. But for good people to do evil
things, that takes religion.
—Steven Weinberg
 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      11-16-2006
wayne wrote:
> M wrote:
>> Thats a good point, the user may not have a pop 3 account set up and
>> the java script did not work....
>>
>> Any suggestions on how to do this form submission....???
>>
>> I'm sure there are solutions out there in the user groups and obviously
>> im not looking in the right place....i would appreciate some useful
>> search tips and if you could also point me towards the right groups for
>> html....even better would be a solution....as ive been attempting this
>> form submission for ages :-<
>>
>> Help me.....
>>

>
> I use a formmail from http://www.tectite.com/ and have had good success
> with it. The file is quite large as all of the documentation is inside.
> It is free and secure.
>
> This is the code I use for the form:
>
> <div id="content">
> <h1>Contact Form</h1>
> <p>Please fill in the blanks and click on "Submit." </p>
> <hr />
>
> <form method="post" action="http://your url here">
> <input type="hidden" name="env_report"
> value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUT H_TYPE,REMOTE_USER" />
> <input type="hidden" name="recipients" value="your email_*_aol.com" />
> <input type="hidden" name="bcc" value="another email_*_yahoo.com" />

WHOA! Do not use such a script that has you put the send to email
address in a hidden file!!! An absolute spam relay form! The send to
address should either be hard-coded in the server-side script or pulled
for a configuration file not accessible to the public. To OP *do not*
use such a script.


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
wayne
Guest
Posts: n/a
 
      11-16-2006
Jonathan N. Little wrote:
> address in a hidden file!!! An absolute spam relay form! The send to
> address should either be hard-coded in the server-side script or pulled
> for a configuration file not accessible to the public. To OP *do not*
> use such a script.
>
>


If you noticed, the email has characters that are replaced on the
server. In addition, the allowed addresses are hardcoded in the
formmail script, server side. You cannot change the address in the form
and have it go any where else except those addresses or domains (if you
have many addresses at one domain) selected by you. Any one attempting
this will generate a message to the administrator, complete with IP
address of offending client. Too many attempts allows you to block the
domain.

There is also an option to place all of the addresses in a configuration
file so none are in any way visible. I just took the easy way out.

You could download the file and examine the code yourself (heavily
commented so you know exactly what is going on).

Regards,

--
Wayne
http://www.glenmeadows.us
With or without religion, you would have good people doing good things
and evil people doing evil things. But for good people to do evil
things, that takes religion.
—Steven Weinberg
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Processing user input as it's entered Sven Python 0 03-26-2013 03:19 PM
Re: Processing user input as it's entered Arnaud Delobelle Python 0 03-26-2013 02:41 PM
Processing user input as it's entered Sven Python 0 03-26-2013 10:07 AM
What to do with #<URI::MailTo:0xb762601c URL:mailto:username@company.com> Thomas Gagne Ruby 2 03-15-2013 10:49 AM
Question: processing HTML, re-write default processing action of many tags Hubert Hung-Hsien Chang Python 2 09-17-2004 03:10 PM



Advertisments