...

View Full Version : Email sender.



Ranger56
06-09-2005, 02:15 AM
I haven't been able to find a script for a form that will make peopel able to send mail to me... Anyone know where I can get one/explain how to make one?

mhunt
06-09-2005, 04:23 AM
orm.html
<form action="process.php" method="post">
Name:<input type="text" name="name" /><br />
Email:<input type="text" name="email" /><br />
Phone:<input type="text" name="phone" /><br />
Comments:<textarea name="comments"></textarea>
</form>

process.php
<?php
$name = $_POST['name'];
$body = $_POST['comments'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$headers = "From: $email Phone: $phone";
$mailContent="--------CONTACT--------\n"
."Name: ".$name."\n"
."E-mail: ".$email."\n"
."Phone: ".$phone."\n"
."Comment/Inquiry: ".$body."\n";
$toAddress="youremail";
$subject="Email from your contact form!";
mail($toAddress,$subject,$mailContent,"From:$email");
?>

Ranger56
06-09-2005, 04:52 AM
So how do I put that into a page...?

(Also, I don't need phone numbers.)

mhunt
06-09-2005, 04:58 AM
two different pages, form.html and process.php

Ranger56
06-09-2005, 05:07 AM
Can I save it as form.php?

(Also, how do I make a submit button for it?)

mhunt
06-09-2005, 05:15 AM
ok look, put this code into form.html
<form action="process.php" method="post">
Name:<input type="text" name="name" /><br />
Email:<input type="text" name="email" /><br />
Comments:<textarea name="comments"></textarea>
</form>

and then put this code into process.php


<?php
$name = $_POST['name'];
$body = $_POST['comments'];
$email = $_POST['email'];
$headers = "From: $email Phone: $phone";
$mailContent="--------CONTACT--------\n"
."Name: ".$name."\n"
."E-mail: ".$email."\n"
."Comment/Inquiry: ".$body."\n";
$toAddress="your@email";
$subject="Email from your contact form!";
mail($toAddress,$subject,$mailContent,"From:$email");
?>

Ranger56
06-09-2005, 05:20 AM
Yeah yeah, I got that. I just need a submit button now...

Yakisoba
06-09-2005, 05:59 AM
Throw this inside the <form>:


<input type="submit" name="Mail" value="Mail" />

Yak

mrruben5
06-09-2005, 09:02 AM
IMO this one is better:
http://pixelfrag.com/forums/showthread.php?t=18



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum