Reputation: 21042
I have a form that I have used before that is just a regular form. You fill out the form and hit submit and it returns a Thank You page. So it goes from form.html to mailPage.php and then Thankyou.html. I have used this same form twice now and it normally works fine but for some reason on this new site it is not sending the email. I know the mailPage is getting called because it sends you to the thankyou page, but no email gets send. Any ideas on what might be causing this. Here is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
</head>
<body>
<?php
$email = $_REQUEST['eMail'] ;
$comments = $_REQUEST['comments'] ;
$year = $_REQUEST['year'] ;
$make = $_REQUEST['make'] ;
$model= $_REQUEST['model'] ;
$zip = $_REQUEST['zip'] ;
$state = $_REQUEST['State'] ;
$city = $_REQUEST['City'] ;
$address = $_REQUEST['Address'] ;
$callTime = $_REQUEST['callTime'] ;
$workNumber= $_REQUEST['workNumber'] ;
$foundby = $_REQUEST['foundby'] ;
$fullName = $_REQUEST['fullName'] ;
$homeNumber = $_REQUEST['homeNumber'] ;
mail( "XXXX@XXXXXXXXXXX", "Estimate Request",
"From:\t$fullName\nEmail:\t$email\nHome Phone:\t$homeNumber\nWork Phone:\t$workNumber\nBest time to call:\t$callTime\nAddress:\n\t$address\n\t$city, $state $zip\nMake: $make\tModel:$model\tYear:$year\nFound us by:\t$foundby\n\nComments:\n$comments");
header( "Location: thankyou.html" );
?>
</body>
</html>
Upvotes: 0
Views: 779
Reputation: 1606
The most common problem would be the input name for email would be different. Could you please do the following? -
echo $email; die("");
If you can see the email being correctly displayed, it will have something to do with the SMTP setup on your server.
Upvotes: 0
Reputation: 86
I've always used the PEAR addition to PHP to send out my mail because I have a lot more control over what it's doing. It needs to have the following two includes called:
require "Mail.php";
require "Mail/mime.php";
I usually do all my processing from my form after those two comments, then I put it all together using the following set of code:
$server = "mail.myserver.com";
$username = "[email protected]";
$password = "thisIsAPassword";
$port = "587";
// Set Up The Mail Headers
$hdrsUs = array(
"From" => $sender,
"To" => $receiverUs,
"Subject" => $subjectUs,
"Return-Path" => $sender
);
// Configure the Mailer Mechanism
$smtp = Mail::factory("smtp",
array(
"host" => $server,
"username" => $username,
"password" => $password,
"auth" => true,
"port" => $port
)
);
$textUs =
"This is a text version of the e-mail.";
$htmlUs =
"<html>
<body>
<center>
<b>This is the HTML version of the e-mail.</b>
</center>
</body>
</html>";
$mimeUs = new Mail_mime($crlf);
$mimeUs->setTXTBody($textUs);
$mimeUs->setHTMLBody($htmlUs);
// Do not EVER Try to Call These Lines in Reverse Order
$bodyUs = $mimeUs->get();
$hdrsUs = $mimeUs->headers($hdrsUs, true);
// Send the Message
$mailUs = $smtp->send($receiverUs, $hdrsUs, $bodyUs);
if (PEAR::isError($mailUs))
{
echo ($mailThem->getMessage());
}
else
{
echo " <br /><center><b>The Mail Has Sent.</b></center>\n";
}
Upvotes: 1
Reputation: 2725
what is the environment your running from?
Does it have a mail server?
Please provide some information about that
so i can give you a correct answer.
Local programs like xampp usualy don't have
mail servers pre-installed.
Upvotes: 1
Reputation: 26573
The only thing comes to mind is that there is no php mail definition on the server... like exim4 or something.
Upvotes: 1