0

我正在使用以下代码发送确认邮件,但我不知道为什么邮件中的 url 参数被删除并且在邮件中我得到的 url 像http://example.com/confirm.php?user_id=参数值 (1) 被删除

$headers = "From: admin@example.com \n";
    $headers .= "X-Mailer: PHP/SimpleModalContactForm";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-type: text/html; charset=utf-8\n";
    $headers .= "Content-Transfer-Encoding: quoted-printable\n";

    $subject = "Confirm Your Registration Example.com";
    $subject = mb_encode_mimeheader($subject, "UTF-8", "B", "\n");
    $to="abc@demo.com";
    $body="<table> <tr> <td> Hello </td> </tr>";
    $body.="<tr> <td> Please confirm your registration by clicking following link  <td> </tr>";
    $body.="<tr> <td>  http://example.com/confirm.php?user_id=1</td> </tr>";

    $body.="</table>";


    @mail($to, $subject, $body, $headers) or  die("Unfortunately, a server issue prevented delivery of your message.");
4

2 回答 2

0

你试过像这样的标签吗

    <a href="http://example.com/confirm.php?user_id=1">http://example.com/confirm.php?user_id=1</a>
于 2012-07-16T06:00:33.950 回答
0

解决了,只是改变了标题

$headers = "From: admin@example.com \n";
$headers .= "X-Mailer: PHP/SimpleModalContactForm";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=utf-8\n";
$headers .= "Content-Transfer-Encoding: quoted-printable\n";

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: admin@example.com' . "\r\n";
于 2012-09-11T07:22:53.277 回答