View Full Version : Email form says it sends, but doesn't

07-05-2005, 10:19 PM
I believe this is the right forum to post my thread, but if not, sorry in advance.

I'm having problems with the email ordering form that I have set up on my website. Whenever I click submit, it says that it has sent the information, but I never receive any emails.

Here's the PHP:

if ($_POST['Submit'])
// email data here
// $var_name = $_POST['form_object_name'];

$your_email = "CKMeth007@hotmail.com";
$subject = "Massive Speed System Order";

$name = $_POST['name'];
$email = $_POST['email'];
$website = $_POST['website'];
$comments = $_POST['comments'];
$fav_thing = $_POST['fav_thing'];
$country = $_POST['country'];

$body = "<strong>First Name</strong> " . $name . "<br>" .
"<strong>Last Name</strong> " . $name_last . "<br>" .
"<strong>Street</strong> " . $street . "<br>" .
"<strong>City </strong>" . $city . "<br>" .
"<strong>State </strong>" . $state . "<br>" .
"<strong>Zip Code</strong> " . $zip_code . "<br>" .
"<strong>Product</strong> " . $product . "<br>" .
"<strong>Quantity</strong> " . $quantity . "<br>" .
"<strong>Color</strong> " . $color . "<br>" .
"<strong>Card Name</strong> " . $card_name . "<br>" .
"<strong>Card No</strong> " . $card_no . "<br>" .
"<strong>Expiration Date</strong> " . $expiration_date . "<br>" .
"<br>" .
"<strong>Comments</strong> <br>" . $comments;

mail($your_email, $subject, $body, "From: \"$name\" <$email>\nContent-Type: text/html; charset=iso-8859-1");
echo "Thank you, your data has been submitted. We will contact you as soon as possible.";

And the HTML:

<form action="http://www.massivespeedsystem.com/orderform2.php" method="post" target="_blank">

<fieldset class="fieldset">

<legend><font color="f77e11">NAME</font></legend>
<label for="first name">First</label><br class="nobr" />
<input name="first name" type="text" class="textfield" id="first name" />
<br />

<label for="last name">Last</label><br class="nobr" />
<input name="last name" type="text" class="textfield" id="last name" />
<br />
<br />

<legend><font color="f77e11">ADDRESS</font></legend>
<label for="street">Street</label><br class="nobr" />
<input name="street" type="text" class="textfield" id="street" />
<br />

<label for="city">City</label><br class="nobr" />
<input name="city" type="text" class="textfield" id="city" />

<label for="state">State</label><br class="nobr" />
<input name="state" type="text" class="textfield" id="state" />

<label for="zip code">Zip Code</label><br class="nobr" />
<input name="zip code" type="text" class="textfield" id="zip code" />
<br />
<br />

<legend><font color="f77e11">PRODUCT INFORMATION</font></legend>
<label for="product">Product</label><br class="nobr" />
<input name="product" type="text" class="textfield" id="product" />
<br />

<label for="quantity">Quantity</label><br class="nobr" />
<input name="quantity" type="text" class="textfield" id="quantity" />

<label for="color">Color</label><br class="nobr" />
<input name="color" type="text" class="textfield" id="color" />
<br />

<legend><font color="f77e11">PAYMENT INFORMATION</font></legend>
<label for="card">Card Name</label><br class="nobr" />
<input name="card" type="text" class="textfield" id="card" />
<br />
<br />

<label for="number">Card No.</label><br class="nobr" />
<input name="number" type="text" class="textfield" id="number" />

<label for="expiration">Expiration Date</label><br class="nobr" />
<input name="expiration" type="text" class="textfield" id="expiration" />
<br />
<br />

<label for="comment">Comments?</label><br class="nobr" />
<textarea cols="30" rows="15" name="comment" id="comment" class="textarea"></textarea>
<br />

<label for="Submit">&nbsp;</label><br class="nobr" />
<input name="Submit" type="submit" class="submit" id="submit" value="Submit" />


Does anyone know why it says that the order has been placed/that the email has been sent but I never receive any orders or emails?

Please note, that as soon as this problem is fixed, this order form will be set up with secure ordering.

07-05-2005, 10:24 PM
You don't check that mail() has mailed (nor can you, I don't think). The output is written regardless.
You host has to have sendmail configured properly.

Check that you can do a very basic mail at all with the mail command before assuming it is anything at all wrong in your script. Maybe their mail server is down or something.

07-05-2005, 10:31 PM
I sort of understand what you're saying, but for the most part I'm confused. Sorry, I'm still very new at this stuff.

Anyways, right now, I have the form set up so that it sends any emails to MY email address (it will be changed to my boss' as soon as the website is done). This way, I can check to see if the form actually sends anything. No matter what I do, I never receive any emails.

07-06-2005, 01:07 AM
You need to check with your host to make sure this mail command is configured.
Who owns the web server this is running from?
Can you get a command line?

The PHP mail command requires sendmail. See the link I posted.
The mail could be sitting in a queue somewhere and not getting sent. Or it could be going to /dev/null.