向雷鸟发送 html 邮件时,PHP 邮件无法显示链接

标签 php html email thunderbird

我有这个脚本可以正常工作。麻烦的是,当我制作 Click here您不能单击 Thunderbird 邮件程序 (Mozilla) 中的链接。如果我看到源代码就可以了。给了什么?

public function send_mail($email='',$subject='',$text='') {
    $mail = new PHPMailer();
    $db = new Db();
    $sql = $db->query("SELECT * FROM configuration WHERE name='shopemail' OR name='shopname'");
    while($configuration = $db->fetchArray($sql)) {
        $row[$configuration['name']] = $configuration['value'];
    }
    // MIME BOUNDARY
    $mime_boundary = $data['shopname'].md5(time());
    $headers = "From: ".$row['shopname']." <".$row['shopemail'].">\n";
    $headers .= "Reply-To: ".$row['shopname']." <". $row['shopemail'].">\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
    // TEXT EMAIL PART
    $message = "--$mime_boundary\n";
    $message .= "Content-Type: text/html; charset=iso-8859-1\n";
    $message .= "Content-Transfer-Encoding: 8bit\n\n";
    $message .= $text."\n";
    // FINAL BOUNDARY
    $message .= "--$mime_boundary--\n\n";
    // SEND MAIL
    $mail_sent = @mail( $email, $subject, $message, $headers );
}

最佳答案

嗯,

解决方案已通过 OP 的评论找到...但是,“接受”的答案仍然会更好,以便其他人立即看到已找到解决方案...

所以,引用我自己的评论:

I guess $text is the HTML content ? Still, we'll probably need to see the HTML code to help (there is no generated in this code, so it'll be hard to find out why it isn't working ^^ ) ; a wild guess : is your link absolute ("example.com/blah.php";) and not relative ("/blah.php") ?

来自 Cudos 的回答:

Doh! made a stupid mistake: Click here missed the "http://" part

(并将其标记为“社区维基”,因此我没有获得任何代表点数——我认为这不“公平”)

关于向雷鸟发送 html 邮件时,PHP 邮件无法显示链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1238157/

相关文章:

linux - 在 Linux 上验证电子邮件地址

php - mysqli 无法在连接上设置 session 时区。保持 UTC。在 RDS mysql 实例上

html - 在 Bootstrap 中插入拉伸(stretch)的背景图像

email - 如何获取当前 Jenkins 用户的电子邮件地址以在 groovy 脚本中使用

ruby-on-rails-3 - Actionmailer BCC 不工作

html - 在 CSS 中的每个元素后添加一个符号

php - mysql connect - 用户名/密码应该硬编码吗?

php - 动态 MySQL 查询

php - Yii 复合主键与 isNewRecord

jquery - 在html元素中动态保存数据