Form Mailer for PHP

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Form Mailer for PHP
DaveTomneyUK
CZ Active Member
uk.gif
Occupation: PC Technician
Age: 50
Gender: Male
Website:
Status: Offline
Joined: Oct 23, 2003
0.03 posts per day
Posts: 201
Points: 23,202
AIM Address Yahoo Messenger  

First off you need to make a file called "contactus.php". Then add the following code to the file:



<html>
<head><title>WWW.DavesHouse.ORG</title></head>
<body>
<form action="mailer.php" method="post">
Your Name : <input type="text" name="name"><br><br>
Your E-Mail : <input type="text" name="email"><br><br>
Message :<br>
<textarea name="message" cols="35" rows="7"></textarea><br><br>
<input type="submit" value="Send">
</form>
</body>
</html>


After you have done that make a file called "mailer.php". Then add the following code to the file:



<html>
<head><title>WWW.DavesHouse.ORG</title></head>
<body>
<?php
print "<center><font color=\"red\">Thank you, <b>$_POST[name]</b>, for your message!<br><br>\n\n";
print "Your e-mail address was: <b>$_POST[email]</b><br><br>\n\n";
print "Your message was: <br><br>\n\n";
print "$_POST[message] <br><br>";

$msg = "Name: $_POST[name]\n";
$msg .= "E-Mail: $_POST[email]\n";
$msg .= "Message: $_POST[message]\n";

$recipient = "webmaster@daveshouse.org";
$subject = "Feedback";
$mailheaders = "From: My Web Site <defaultaddress@yourdomain.com>\n";
$mailheaders .= "Reply-To: $_POST[email]";

mail($recipient, $subject, $msg, $mailheaders);
?>
</body>
</html>


NOTE - Dont forget to change the "$recipient" to your E-Mail address.


Back to top Reply with quote
#2   re: Form Mailer for PHP
Kelly_Hero
PayPal Donation
CZ Revered Member
 Codezwiz Site Donator
usa.gif southcarolina.gif
Occupation: Web Developer
Age: 59
Gender: Female
Website:
Status: Offline
Joined: Aug 20, 2003
0.48 posts per day
Posts: 3765
Points: 351,412
   
Thanks! I'm sure that's gonna come in handy!! icon_biggrin.gif

Kelly



Back to top Reply with quote
#3   re: Form Mailer for PHP
Ryman
CZ Super Newbie
Ryman has been a member for over 20 year's 20 Year Member
usa.gif illinois.gif
Occupation: Student, Webmaster, That little annoying geek
Fav. Sports Team: STL Cardinals
Website:
Status: Offline
Joined: Jan 13, 2004
0.01 posts per day
Posts: 50
Points: 3,510
   
i would like to point out that you must be on a host that allows the mail() function in order for this to work.



Back to top Reply with quote
#4   re: Form Mailer for PHP
DaveTomneyUK
CZ Active Member
uk.gif
Occupation: PC Technician
Age: 50
Gender: Male
Website:
Status: Offline
Joined: Oct 23, 2003
0.03 posts per day
Posts: 201
Points: 23,202
AIM Address Yahoo Messenger  
YA but mosts hosts support the mail() function so long as its not a free one I don't think they do some don't anyway.



Back to top Reply with quote
#5   re: Form Mailer for PHP
Ryman
CZ Super Newbie
Ryman has been a member for over 20 year's 20 Year Member
usa.gif illinois.gif
Occupation: Student, Webmaster, That little annoying geek
Fav. Sports Team: STL Cardinals
Website:
Status: Offline
Joined: Jan 13, 2004
0.01 posts per day
Posts: 50
Points: 3,510
   
mine does, but to prevent spamming my host only allows me to send out 20 emails per day. if i go over my account is automatically deleted



Back to top Reply with quote
#6   re: Form Mailer for PHP
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 20 year's 20 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
lol @ it says, thankyou, gareth, for you massage



Back to top Reply with quote
#7   re: Form Mailer for PHP
DaveTomneyUK
CZ Active Member
uk.gif
Occupation: PC Technician
Age: 50
Gender: Male
Website:
Status: Offline
Joined: Oct 23, 2003
0.03 posts per day
Posts: 201
Points: 23,202
AIM Address Yahoo Messenger  
Oooop a little typo by me... icon_smile.gif Fixed it.



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum