# How do I set up a text box that will send info to my email?



## Perseus (Sep 6, 2005)

Since action:mailto is old and tacky, and since I don't know much about scripting, can anyone provide me with a tutorial or URL to ONE THAT WORKS?  I just need people to enter some text, hit submit, and have that info send to my email address. Thanks!!


----------



## ElDiabloConCaca (Sep 6, 2005)

I find that PHP or CGI scripts are the best solution.  I've had good luck with this script:
http://www.scriptarchive.com/formmail.html

However, you can do it using GET instead of POST on the submit button and passing variables like this:


```
a href="mailto:whoever@whereever.com?subject=Typemysubjecthere?&body=Body of email document">Send email</a>
```

The downside is that the body of the message is limited to 255 characters.


----------



## Perseus (Sep 7, 2005)

I downloaded that script and began reading the READ ME, and it would have best been written in Gibberish. I have absolutely no idea what this guy is talking about. It seems like he is talking about which email addresses to allow, I am looking for text entered on a website to be sent to ME. I dont care who can type stuff in there, just get the friggin text to me!


----------



## nixgeek (Sep 7, 2005)

Yeah you need to have a server that support CGI scripts for it to work.  I had to do something similar for a church website.  Mind you, I'm no coder but I can understand the flow of the code.  I used to Google to perform my research regarding email forms on websites.  They exist, but again the server hosting the site has so support CGI scripts and perl or another scripting language (depending on what the code in the script is).


----------



## kainjow (Sep 7, 2005)

If you have PHP setup on your server, it takes one line of code to process the form and send the email (more if you want validation). PM/post/email me and I can help you with the code.


----------



## simbalala (Sep 7, 2005)

Here's a simple and easy to use php script with html:

http://www.xentrik.net/php/mailform.php


----------



## Perseus (Sep 7, 2005)

Simbalala, that seems like a good one, however I don't understand how to integrate it into an allready existing page. The working example is on a seperate page on its own, I need it to be on a page I have allready made code for.  Can I reference/call it like a css file? Or do I just copy and paste all of this code into my page?


----------



## Veljo (Sep 7, 2005)

Looks to me like you can have your normal HTML file, and it needs to point to the php document to send.


----------



## simbalala (Sep 7, 2005)

Veljo said:
			
		

> Looks to me like you can have your normal HTML file, and it needs to point to the php document to send.



That's the way I've used it. Very convenient, just a link and the contact page appears.

I did have to add stripslashes to it because my servers have magic quotes turned on


```
// send mail and print success message
$message = stripslashes($message);
$Name = stripslashes($Name);
mail($recipientemail,"$subject","$message","From: $Name <$Email>");
```

You may or may not need to do this depending on your server.

You'll know if the emails you get look like this:

The quick brown fox jumped over the dog\'s back.

You could add the code to your regular html page, just play around with it. It's pretty easy to understand. If you're new at this the easiest thing might be to customize the new contact page until it looks like your original html page then swap them.


----------

