这是在LAMP服务器上。
我在网上找到的所有答案都表明上述方法之一应该有效,但我无法使其正常工作。
我的代码是:
$to = $email_to;
$subject = 'Website Form';
$message = 'From: ' . $name .
' \r\n Date: ' . $date .
' \r\nText: ' . $text .
'\r\n Use on Presentations?: ' . $presentations .
'\r\n Use on Websites?: ' . $website .
'\r\n Use on Case Studies?: ' . $casestudy;
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
有人知道我做错了吗?
您正在使用单引号,如果要使用\ n或\ r,则必须将它们放在双引号中,例如:
$value = "here is some text, and a $variable, and a line end\r\n";
我做了很多php mailer的工作,并且\ r \ n必须在“ ...”中,否则它不是作为转义字符执行的,而是作为文字执行的。
IE:
echo ".\n.";
# is this:
.
.
#but
echo '.\n'.;
#is this:
.\n.
就这样。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句