mail();
我对 PHP函数有一个奇怪的问题。
像这样使用它
$header = "MIME-Version: 1.0" . "\r\n";
$header .= "Content-type: text/html; charset=utf-8" . "\r\n";
$header .= "Content-Transfer-Encoding: quoted-printable" . "\r\n";
$header .= "Reply-To:" . $email . "\r\n";
$header .= "From: Kontaktformular <noreply@thomas-glaser-foto.de>" . "\r\n";
mail( "mail.me@mail.com", "Message from " . $name . " through your website!", $message, $header );
一切都按预期工作。邮件被发送,一切都被正确编码,主题也很好。
但是当我用这样的单引号更改双引号时:
$header = 'MIME-Version: 1.0' . '\r\n';
$header .= 'Content-type: text/html; charset=utf-8' . '\r\n';
$header .= 'Content-Transfer-Encoding: quoted-printable' . '\r\n';
$header .= 'Reply-To:' . $email . '\r\n';
$header .= 'From: Kontaktformular <noreply@thomas-glaser-foto.de>' . '\r\n';
mail( 'mail.me@mail.com', 'Message from ' . $name . ' through your website!', $message, $header );
邮件仍会发送,但没有设置主题。相反,它是
www-data@domain.com
特殊字符也被破坏。那里发生了什么?