Page 1 of 1

PHP Mailer not working correctly

Posted: Mon Oct 13, 2008 6:07 pm
by ctate76
Hi guys, I'm new to this forum so bear with me since this is my first post.

I have a PHP mailer form in my CSS page that will not send mail for some reason. Can anyone take a look at my code and maybe help out? Thanks in advance for any help.

I've got my php file saved in the same directory as my html if that helps.

HTML:

Code: Select all

<form method="post" action="mailer.php"></form>
        <label for="name">name:</label>
        <input type="text" name="name" size="30"></input><br />
        <br />
        <label for="address">email:</label>
        <input type="text" name="email" size="30"></input><br />
        <br />
        <label for="message">message:</label>
        <textarea rows="9" name="message" cols="60"></textarea>
        <br />
        <input class="submit_input" type="submit" value="Send" name="submit"></input>
PHP:

Code: Select all

<?php
if(isset($_POST['submit'])) {
$to = "christian.tate@gmail.com";
$subject = "Form Tutorial";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
 
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
 
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "blarg!";
}
?>

Re: PHP Mailer not working correctly

Posted: Tue Oct 14, 2008 1:58 am
by jaoudestudios
What server are you running?

Re: PHP Mailer not working correctly

Posted: Tue Oct 14, 2008 5:00 am
by ctate76
This is where I show how inexperienced I am with all this. Not sure, would Linux be the answer? Apparently it also says that I have PHP 5x version. I know this isn't much but again, server-side is all so new to me. Thanks again.

Re: PHP Mailer not working correctly

Posted: Tue Oct 14, 2008 11:56 am
by jaoudestudios
The reason I ask is to find out if you have a mailserver on the server to send an email using the php mail function.

Do you have emails hosted on the server?