我有这个脚本可以正常工作。麻烦的是,当我制作 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/