我有 PHP 邮件程序脚本,我正在尝试将 HTML 表添加到其中,但是当我这样做时脚本停止工作。
这是 PHP 邮件程序脚本
<?php
// Insert your email/web addresses and correct paths
$mailto = 'adil@*******.co.uk' ;
$from = "web@city.com" ;
$subject = "Query from ******* 2012";
$headers = "From: ******* Website";
$formurl = "http://*******.co.uk/citycoaches3/formmail.php" ;
$errorurl = "http://*******.co.uk/citycoaches3/error.php" ;
$thankyouurl = "http://*******.co.uk/citycoaches3/thankyou.php" ;
// Place Your Form info here...
$pickuppoint = ($_POST['pickuppoint']);
$destination = ($_POST['destination']);
// Check If Empty
// Add more Validation/Cleaning here...
// Place your Corresponding info here...
$message =
"Pick Point: $pickuppoint\n\n" .
"Destination: $destination\n\n" .
"noppl: $noppl\n\n"
;
// Leave Alone
mail($mailto, $from, $message);
header( "Location: $thankyouurl" );
exit ;
?>
对此的任何帮助将不胜感激。
这是我尝试过的
<?php
$fromAddr = 'adil@********.co.uk'; // the address to show in From field.
$recipientAddr = 'quotes@********.co.uk';
$subjectStr = '[Quick] Query From ********';
$date = date ("l, F jS, Y");
$time = date ("h:i A");
$forward = 1;
$formurl = "http://www.********.co.uk/formmail.php" ;
$errorurl = "http://www.********.co.uk/error.php" ;
$thankyouurl = "http://www.********.co.uk/thankyou.php" ;
header("location:thankyou.php");
$mailBodyText = <<<HHHHHHHHHHHHHH
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Thank You</title>
</head>
<body>
<img src="http://********.co.uk/images/mailsig.png" /> \n\n<br />
<span style="color:#900; font-size:18px;">Below is the result submitted from <strong>[Quick Quote] ******** Website</strong>. It was submitted on <strong>$date at $time</strong>.\n\n</span>
<p><table width="600" border="1" cellpadding="5px">
<tr>
<td><b>Pickup Date:</b> </td>
<td>{$_POST['date']}<br></td>
</tr>
<tr>
<td><b>Pickup Time:</b> </td>
<td>{$_POST['PickupTime-Hours']}:{$_POST['PickupTime-Mins']}<br></td>
</tr>
<tr>
<td><b>Pickup Point:</b> </td>
<td>{$_POST['PickUp-Point']}<br></td>
</tr>
<tr>
<td><b>Destination:</b> </td>
<td>{$_POST['Destination']}<br></td></tr>
<tr>
<td><b>No. Of People:</b> </td>
<td>{$_POST['No-of-Persons']}<br></td>
</tr>
<tr>
<td><b>Journey Type:</b> </td>
<td>{$_POST['JourneyType']}<br></td>
</tr>
<tr>
<tr>
<td><b>Return Date:</b> </td>
<td>{$_POST['returnDate']}<br></td>
</tr>
<tr>
<td><b>Return Time:</b> </td>
<td>{$_POST['returnTime-Hours']}{$_POST['returnTime-Mins']}<br></td>
</tr>
<tr>
<tr>
<td><b>Vehicle Type:</b> </td>
<td>{$_POST['type']}<br></td>
</tr>
<tr>
<tr>
<td><b>Full Name:</b> </td>
<td>{$_POST['Full-Name']}<br></td>
</tr>
<tr>
<tr>
<td><b>Tel / Mobile:</b> </td>
<td>{$_POST['Tel-Mobile']}<br></td>
</tr>
<tr>
<td><b>Email:</b> </td>
<td>{$_POST['Email']}<br></td>
</tr>
<tr>
</table>
</p>
</body>
</html>
HHHHHHHHHHHHHH;
$headers= <<<TTTTTTTTTTTT
From: $fromAddr
MIME-Version: 1.0
Content-Type: text/html;
TTTTTTTTTTTT;
mail($mailto, $from, $message,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep );
header( "Location: $thankyouurl" );
exit ;
?>
由于某种原因仍然无法正常工作。
这是更新:
删除后
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" .
我设法收到了这封电子邮件,但它粘贴了 $message 中的整个代码。