我的網站是salonesvip.clPHP電子郵件與西班牙口音不正確
該網站本身顯示西班牙口音完美,沒有問題那裏。 在聯繫表單本身,它顯示西班牙口音。 生成併發送給我的電子郵件一旦發送......這就是問題所在。
我唯一的猜測是它的PHP,因爲網站顯示他們沒有問題。
我花了數小時試圖找到解決方案,我真的找不到修復程序。
我附上的PHP,希望有人知道什麼是問題...如果你需要更多的信息,請告訴我。
感謝
mailer.php
<?php
// Only process POST reqeusts.
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get the form fields and remove whitespace.
$name = strip_tags(trim($_POST["name"]));
$name = str_replace(array("\r","\n"),array(" "," "),$name);
$salon = $_POST["salon"];
$email = filter_var(trim($_POST["email"]), FILTER_SANITIZE_EMAIL);
$celu = trim($_POST["celu"]);
$creditCard = trim($_POST["creditCard"]);
$subjectwa = $_POST["subject"];
$message = trim($_POST["message"]);
// Check that data was sent to the mailer.
if (empty($name) OR empty($message) OR empty($celu) OR empty($creditCard) OR !filter_var($email, FILTER_VALIDATE_EMAIL)) {
// Set a 400 (bad request) response code and exit.
http_response_code(400);
echo "Oops! No se puede enviar el formulario, verifica los campos.";
exit;
}
// Set the recipient email address.
// FIXME: Update this to your desired email address.
$recipient = "[email protected]";
// Set the email subject.
$subject = "Contacto desde el sitio web. Su nombre es: $name";
// Build the email content.
$email_content = "Name: $name\n\n";
$email_content .= "Salon: $salon\n\n";
$email_content .= "Email: $email\n\n";
$email_content .= "Celular: $celu\n\n";
$email_content .= "Credit Card: $creditCard\n\n";
$email_content .= "Subject: $subjectwa\n\n";
$email_content .= "Message:\n$message\n";
// Build the email headers.
$email_headers = "From: $name <$email>";
// Send the email.
if (mail($recipient, $subject, $email_content, $email_headers)) {
// Set a 200 (okay) response code.
http_response_code(200);
echo "Gracias! Su mensaje ha sido enviado.";
} else {
// Set a 500 (internal server error) response code.
http_response_code(500);
echo "Oops! No se puede enviar el formulario, verifica los campos.";
}
} else {
// Not a POST request, set a 403 (forbidden) response code.
http_response_code(403);
echo "Oops! No se puede enviar el formulario, verifica los campos.";
}
>
可能的重複http://stackoverflow.com/questions/2265579/php-e-mail-encoding – JCOC611