【发布时间】:2020-01-30 12:47:07
【问题描述】:
我正在使用 php 标头发送电子邮件。
$to = 'test@email.com';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$message = '<h1>Test</h1>';
mail($to, $subject, $message, $headers);
此功能运行正常。
但是在我添加了“From”之后,mail() 函数就不起作用了。
$headers .= "From: from@address.com";
有什么想法吗?
【问题讨论】:
-
最后必须有
. "\r\n" -
尝试使用 From first 然后 MIME 然后 content type 更改条目的顺序。