Phpmailer 遇到变音问题

Phpmailer having problems with Umlaut

我设置了一个反馈表,但它在元音变音(元音突变)方面不稳定。例如。有时它会将 'ö' 显示为 'ö'(正确),但有时我会得到一些奇怪的东西,例如 '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'); 

但是我从服务器收到一条错误消息,虽然邮件已发送,但主题中没有正确的变音符号,所以这似乎没有用。

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";