Question:
HTML HELP? How to send form by e-mail??
anonymous
2008-08-19 08:19:51 UTC
All I know is basic HTML and CSS. I am making a simple contact us form but how in the world can I make it so that when the user fills out everything, and clicks the submit button, the form gets sent to an e-mail address I specified?? I don't want to do mailto:someone@somewhere.com because that opens your e-mail. I just need the user to click submit and thats it, like all the other forms on the internet.

Please explain clearly how I can do this. I need this URGENT! Thanks.
Five answers:
anonymous
2008-08-19 09:27:03 UTC
Couple of ways. The PHP Mail Function has already been described.



The other method is using a CGI script. Most servers already have them put together, you simply need to find them, and follow the instructions on using them. If your server does NOT provide a CGI Form Mailer in their package, you can write one all by yourself. It really isn't as difficult as you might imagine. Full instructions can be found here:



http://www.elated.com/articles/writing-a-simple-form-mailer/



That one is all you would need...simple and easy to use.
Kelly
2016-04-09 02:20:21 UTC
it sounds to me like you are having the user send you an email message but what you really want is to submit the info they filled in to your server (via POST) and then have YOUR server send you the email. If you have the user send the email with their account then it will tell them and try to open their default mail application in this case outlook. so make your form a submit form using post as the method. I assume you currently have something like change it to hope this helps :)
ItsJareds
2008-08-19 08:26:38 UTC
You need to use the PHP mail function. PHP is a server-side language, which means not all web hosts come with PHP installed.



Find a web host that offers PHP, and make a new file called send.php.



Put this in it:






$to = "someone@example.com";

$subject = "Test mail";

$message = "Hello! This is a simple email message.";

$from = "someonelse@example.com";

$headers = "From: $from";

mail($to,$subject,$message,$headers);

echo "Mail Sent.";



?>



Save it, then make a new file called mail.html:










if (isset($_REQUEST['email']))

//if "email" is filled out, send email

{

//send email

$email = $_REQUEST['email'] ;

$subject = $_REQUEST['subject'] ;

$message = $_REQUEST['message'] ;

mail( "someone@example.com", "Subject: $subject",

$message, "From: $email" );

echo "Thank you for using our mail form";

}

else

//if "email" is not filled out, display the form

{

echo "


Email:


Subject:


Message:







";

}

?>









Save that, then view mail.html. This should send to someone@example.com (or whatever you changed it to).
Tom H
2008-08-19 09:47:20 UTC
Here is another low tech resource for you. Maybe not the best solution, but you can try it.



http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_mail
oweaponx
2008-08-19 08:32:57 UTC
I did this mail form for class. You would change the method to method="get" and action="email@yahoo.com" for example. Change the fields to whatever you want.



















































































FULL NAME:
STREET ADDRESS:
CITY:
STATE/PROVINCE:
COUNTRY:
ZIP/POSTAL CODE:
FULL PHONE NUMBER:
SERVICES REQUESTED:
OTHER:












Other sources:

http://www.mycontactform.com/

http://www.response-o-matic.com/

www.emailmeform.com


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...