This tutorial is how to create a simple email form for a web site.First, place this form code below in a HTML file or on the HTML web page you want it on thats already set up on your server.
The HTML part of it:
<form method="post" action="sendmail.php">
Email:
<br />
<input name="email" type="text" /><br />
Message:
<br />
<textarea name="message" rows="15" cols="40">
</textarea>
<br />
<input type="send" /></form>
Now to the PHP part of it:When the submit input button is clicked , it calls the file "sendmail.php", as you can see in the above form code
So Lets do that file now.
Now create a php file and paste this code below in the file and name it "sendmail.php"
<?php
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
mail( "YOUR MAIL", "MY WED SITE MAIL",
$message, "From: $email" );
?>
Thanks for sending your mail, we will get back to you as soon as possible
Theres three things you must change, the email address in the second part of code that says
YOUR MAIL in which the email is going to be sent to. (meaning your main email address you want your web mail to be sent to)
and then the subject of the email that way you know it is coming from your website mail form, so also change where it says
MY WEB SITE MAIL to whatever you want the title to be so you can recognize it.
I also added a section of text underneath the sendmail.php coding that says:
"
Thanks for sending your mail, we will get back to you as soon a possible"
You can change that also to whatever you like , so you are sending them back a Thanks for sending mail to your site. Thats always nice to do and professional .