Phpmailer与Umlaut有问题


Phpmailer having problems with Umlaut

我有一个反馈表设置,但它是不稳定的,当它涉及到umlaute(元音突变)。例如,有时它会将'ö'显示为'ö'(正确),但有时我会得到一些奇怪的东西,如'H¼ttenkäse'而不是'Hüttenkäse'。

页面编码(在Dreamweaver中)被设置为Unicode (UTF-8),在phpmailer中我也改变了它:

/**
 * The character set of the message.
 * @type string
 */
public $CharSet = 'UTF-8';

我在send.php开头尝试了以下操作:

header('charset=utf-8'); 

但是我从服务器得到了一个错误消息,虽然邮件被发送了,但是在主题中没有正确的umlaute,所以这似乎不起作用。

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]);
	if ($anredeGross === "Herr") {
		$anredeGross = $anredeGross . "n";
	} elseif ($anredeGross === "Leer") {
		$anredeGross = $vorn;
	} else {
		$anredeGross = $anredeGross;	
	}
$firma = $_POST['firma'];
	if ($firma !=='') {
		$firma = ' von der Firma '.$firma;	
	} else {
		$firma = '';
	}
$to_name = "Service Provicer";
$to = "service@demo.com";
$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';
?>

现在我真的不知道我还能做什么!非常感谢您的帮助,我期待您的建议!

感谢adlag的输入,这是解决方案:

$mail->CharSet ="UTF-8";