Page 1 of 1

Email script not working!

Posted: Tue Jan 18, 2005 2:34 pm
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..

Posted: Tue Jan 18, 2005 2:40 pm
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.

Posted: Tue Jan 18, 2005 2:42 pm
by O2xygen
Ok. Thanks. Im going to upload them to the web server now. See if that works.