Email script not working!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
O2xygen
Forum Newbie
Posts: 2
Joined: Tue Jan 18, 2005 2:29 pm

Email script not working!

Post by O2xygen »

Hey all.

Grrr. Im having troubles with PHP. Anyways, I've made (i think) a script that allows you send an email from a web page.

the trouble is that I dont recieve the email!
Heres the form script:
<form action="contact.php" method="POST">
<tr><td>Your Name</td><td><input type="text" name="name"></td></tr>
<tr><td>Your Email Address</td> <td><input type="text" name="email"></td></tr>
<tr><td>Subject</td><td><input type="text" name="Subject"></td></tr>
<tr><td>Message:</td><td><textarea name="message" rows="5"></textarea></td></tr>
<tr><td colspan="2"><center><input type="submit" name="Send" value="Send"></center></td></tr>
</form>

And heres the PHP script.
<?php
$senderemail = $_POST['email'];
$sendername = $_POST['name'];
$sendersubject = $_POST['subject'];
$sendermessage= $_POST['message'];
$recipient = "berrett@paradise.net.nz";
$subject = "Contact Message from rpgames";
$mailheader = "From: $senderemail\r\n";
$mailheader .= "Reply-To: $senderemail\r\n";
$message = "Sender's name: $sendername\n";
$message .= "Sender's message: $sendermessage\n\n";
mail($recipient, $subject, $message, $mailheader) or die ("Failure");
?>

Thanks in advance. Not sure if i was specific enough..
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

if this is on a Windows server/machine, you'll need to set up the smtp settings in php.ini. At any rate, check the settings used for sending mail.

Turn on full error_reporting() (E_ALL), you may want to check your error logs on the server as well.
User avatar
O2xygen
Forum Newbie
Posts: 2
Joined: Tue Jan 18, 2005 2:29 pm

Post by O2xygen »

Ok. Thanks. Im going to upload them to the web server now. See if that works.
Post Reply