URL中的参数值在邮件中使用php中的mail()删除


Parameter value in URL does removed in mail by using mail() in php

我使用以下代码发送确认邮件,但我不知道为什么邮件中的url参数被删除在邮件中,我得到了类似http://example.com/confirm.php?user_id=的url参数值(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.");

你试过使用这样的标签吗

    <a href="http://example.com/confirm.php?user_id=1">http://example.com/confirm.php?user_id=1</a>

已解决,刚刚从更改了标题

$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";