4
我有一個反饋表格,但它在umlaute(元音變異)時不穩定。例如。有時它會顯示'ö'爲'ö'(正確),但有時候我會看到'Hüttenkäse'而不是'Hüttenkäse'這樣的奇怪事物。Phpmailer存在變音問題
頁編碼(在Dreamweaver)設置爲Unicode(UTF-8),在PHPMailer的,我改變它,以及:
/**
* The character set of the message.
* @type string
*/
public $CharSet = 'UTF-8';
我想在我send.php開頭的以下內容:
header('charset=utf-8');
但我從服務器收到一條錯誤消息,雖然郵件已發送,但在主題中沒有正確的語音,所以這似乎不起作用。
的send.php通過這種形式引發的:
<form method="post" action="send.php">
和send.php看起來是這樣的:
<?php
require_once("includes/phpMailer/class.phpmailer.php");
require_once("includes/phpMailer/class.smtp.php");
require_once("includes/phpMailer/language/phpmailer.lang-de.php");
$dl = $_GET['dienstleistung'];
$vorn = $_POST['vorname']; // für Vorname falls keine Anrede
$anredeGross = ucfirst($_POST[anrede]);
\t if ($anredeGross === "Herr") {
\t \t $anredeGross = $anredeGross . "n";
\t } elseif ($anredeGross === "Leer") {
\t \t $anredeGross = $vorn;
\t } else {
\t \t $anredeGross = $anredeGross; \t
\t }
$firma = $_POST['firma'];
\t if ($firma !=='') {
\t \t $firma = ' von der Firma '.$firma; \t
\t } else {
\t \t $firma = '';
\t }
$to_name = "Service Provicer";
$to = "[email protected]";
$subject = "Anfrage von ".$anredeGross." ".$_POST['name'].$firma;
$message = $_POST['nachricht']."\n \n"."Ich interessiere mich für die folgenden Dienstleistungen: "."\n \n";
$message .= implode(', ', $_POST['dienstleistungen']);
$message = wordwrap($message, 70);
$from_name = $_POST['vorname'] . " " . $_POST['name'];
$from = $_POST['email'];
$mail = new PHPMailer();
$mail->Host = "www.myhost.host";
$mail->Port = 25;
$mail->SMTPAuth = false;
$mail ->Username = "username";
$mail ->Password = "password";
$mail->FromName = $from_name;
$mail->From = $from;
$mail->addAddress($to, $to_name);
$mail->Subject = $subject;
$mail->Body = $message;
$result = $mail->send();
echo $result ? 'Sent' : 'Error';
?>
現在我真的不知道知道我還能做什麼!非常感謝您的幫助 - 我期待您的建議!
可能重複[如何設置郵件主題變音ü](http://stackoverflow.com/questions/13645869/how郵件主題) – adlag
非常感謝,對於多餘的帖子感到抱歉,所以這爲我解決了它: $ mail-> CharSet =「UTF-3」 8" ; – Ollie