我对PHPMailer脚本有点问题。
$mail = new PHPMailer(true); // Passing `true` enables exceptions
try {
// Server settings
//$mail->CharSet = "UTF-8";
$mail->SMTPDebug = 2; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = ''; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = ''; // SMTP username
$mail->Password = ''; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
// Recipients
$mail->setFrom('info@example.com', 'Störungsfall');
$mail->addAddress('mail@example.com', 'name'); // Add a recipient
// Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Störungsmeldung für.. '. $suchtext .'.';
$mail->Body = '
<html>
... html mail..
</html>
...
我的变音符号无法正确显示。如果我省略CharSet,它看起来像这样:
如果我设置CharSet,它看起来像这样:
我尝试使用ö
代替ö
,但它在标题中出现了1:1 St ö
ungsfall。
这是调试日志,也许它比我更有帮助:(
2018-01-15 15:23:31 CLIENT -> SERVER: From: =?UTF-8?Q?St=F6rungsfall?= <info@example.com>
2018-01-15 15:23:31 CLIENT -> SERVER: Subject: =?UTF-8?Q?St=F6rungsmeldung_f=FCr.._example.?=