我从以前的供应商那里继承了一份电子邮件表格,在我们将它移到它的新服务器后,它开始出现故障。它应该做的是向填写它的用户发送一封验证电子邮件(这样做),然后发送一封电子邮件到warranty@mydomain.com 和密件抄送:另一个地址(它不再这样做)。尝试了一切,但我对 PHP 不是超级精通,主要是前端编码器,任何人都可以查看我的代码并告诉我为什么无法正确发送?
PHP代码:
<?php
header("location: http://www.anatomicglobal.com/warranty/regthanks.html");
$posting = array(
'Name' => $_POST['Name'],
'Email' => $_POST['Email'],
'Phone' => $_POST['Phone'],
'Address' => $_POST['Address'],
'City' => $_POST['City'],
'State' => $_POST['State'],
'Province' => $_POST['Province'],
'Zip' => $_POST['Zip'],
'Product' => $_POST['check'][0],
'Size' => $_POST['size'][0],
'Mattress Model Name' => $_POST['MattressModeName'],
'Mattress Model Number' => $_POST['MattressModeNo'],
'Serial Number' => $_POST['SerialNumber'],
'Store Name' => $_POST['StoreName'],
'Purchase Month'=> $_POST['Month'],
'Purchase Day' => $_POST['Day'],
'Purchase Year' => $_POST['Year']
);
$decide = $_POST['decide'];
$subject = 'Eco Memory Foam - Warranty Registration';
$to = 'warranty@anatomicglobal.com';
$to = $posting['Email'];
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'To: Anatomic Global <warranty@anatomicglobal.com>' . "\r\n";
$headers .= 'From: ecomemoryfoam.com <warranty@anatomicglobal.com>' . "\r\n";
$headers .= 'Reply-To: ' . $posting['Email'] . "\r\n";
$headers .= 'bcc: Hollyce Weber <hweber@anatomicglobal.com>' . "\r\n";
$message = '<html>';
$message .= '<head><title>Eco Memory Foam - Warranty Registration</title></head><body>';
$message .= '<h1>Eco Memory Foam - Warranty Registration</h1>';
$message .= '<p><strong>Warranty Registration</strong> submission successful, please keep for your records.</p>
';
$message .= '<p>Below is the submitted information at: <strong>' . strftime("%B %d %Y - %H:%M:%S", time()) . '</strong></p>';
$message .= '<dl>';
foreach ($posting as $field => $value) {
$message .= '<dt>';
$message .= '<dd><b>' . $field . '</b>: ' . $value . '</dd>';
$message .= '</dt>';
};
$message .= '<dt>Decide to Purchase This Product?</dt>';
$message .= '<dd>Customer Selected:<ul>';
foreach ($decide as $field => $value) {
$message .= '<li>' . $value . '</li>';
};
$message .= '</ul></dd>';
$message .= '</dl>';
/**$message .= '<p>You can reply to the submitter by replying to this email (if they gave you a valid email address).</p></body></html>';**/
mail($to, $subject, $message, $headers);
几个小时之后....
感谢大家的帮助,但它仍然没有发送任何东西,新代码如下所示:
<?php
$posting = array(
'Name' => $_POST['Name'],
'Email' => $_POST['Email'],
'Phone' => $_POST['Phone'],
'Address' => $_POST['Address'],
'City' => $_POST['City'],
'State' => $_POST['State'],
'Province' => $_POST['Province'],
'Zip' => $_POST['Zip'],
'Product' => $_POST['check'][0],
'Size' => $_POST['size'][0],
'Mattress Model Name' => $_POST['MattressModeName'],
'Mattress Model Number' => $_POST['MattressModeNo'],
'Serial Number' => $_POST['SerialNumber'],
'Store Name' => $_POST['StoreName'],
'Purchase Month'=> $_POST['Month'],
'Purchase Day' => $_POST['Day'],
'Purchase Year' => $_POST['Year']
);
$decide = $_POST['decide'];
$subject = 'Eco Memory Foam - Warranty Registration';
$to = "warranty@anatomicglobal.com, {$posting['email']}";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'To: Anatomic Global <warranty@anatomicglobal.com>' . "\r\n";
$headers .= 'From: ecomemoryfoam.com <warranty@anatomicglobal.com>' . "\r\n";
$headers .= 'Reply-To: ' . $posting['Email'] . "\r\n";
$headers .= 'bcc: Hollyce Weber <hweber@anatomicglobal.com>' . "\r\n";
$message = '<html>';
$message .= '<head><title>Eco Memory Foam - Warranty Registration</title></head><body>';
$message .= '<h1>Eco Memory Foam - Warranty Registration</h1>';
$message .= '<p><strong>Warranty Registration</strong> submission successful, please keep for your records.</p>
';
$message .= '<p>Below is the submitted information at: <strong>' . strftime("%B %d %Y - %H:%M:%S", time()) . '</strong></p>';
$message .= '<dl>';
foreach ($posting as $field => $value) {
$message .= '<dt>';
$message .= '<dd><b>' . $field . '</b>: ' . $value . '</dd>';
$message .= '</dt>';
};
$message .= '<dt>Decide to Purchase This Product?</dt>';
$message .= '<dd>Customer Selected:<ul>';
foreach ($decide as $field => $value) {
$message .= '<li>' . $value . '</li>';
};
$message .= '</ul></dd>';
$message .= '</dl>';
/**$message .= '<p>You can reply to the submitter by replying to this email (if they gave you a valid email address).</p></body></html>';**/
mail($to, $subject, $message, $headers);
header("location: http://www.anatomicglobal.com/warranty/regthanks.html");