以前のベンダーから電子メール フォームを継承しましたが、新しいサーバーに移動した後、誤動作し始めました。それがすべきことは、入力したユーザーに確認メールを送信し (これを行います)、次に、warranty@mydomain.com と bcc: 別のアドレスにメールを送信することです (これはもはや行われません)。すべてを試してみましたが、私は 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");