0
我使用AJAX和PHP發送電子郵件與聯繫人表單中的數據。我使用下面的PHP:發送PHP確認電子郵件管理員電子郵件發送
if (mail($recipient, $subject, $email_content, $email_headers)) {
// Set a 200 (okay) response code.
http_response_code(200);
} else {
// Set a 500 (internal server error) response code.
http_response_code(500);
echo "Oops! Something went wrong and we couldn't send your message.";
}
這是工作的罰款,但如果這第一封電子郵件被髮送,我也想送一個確認郵件用新的參數。我想我應該能夠只設置其他郵件()函數,如200響應代碼之後:
if (mail($recipient, $subject, $email_content, $email_headers)) {
// Set a 200 (okay) response code.
http_response_code(200);
mail($email, $confirmation_subject, $confirmation_content, $confirmation_headers);
} else {
// Set a 500 (internal server error) response code.
http_response_code(500);
echo "Oops! Something went wrong and we couldn't send your message.";
}
但是這是造成發送電子郵件既不。如果發送管理員電子郵件,實施確認電子郵件的正確方法是什麼?
這看起來不錯,所以你需要做一些基本的調試,看看發生了什麼。使用調試器來遍歷代碼。 – Synchro