【发布时间】:2009-08-06 10:45:42
【问题描述】:
我有这个可以正常工作的脚本。麻烦的是,当我创建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 );
}
【问题讨论】:
-
我假设
$email是 HTML 内容 - 如果是这样,您必须提供$email的示例值。 Thunderbird 中的链接是什么样的?它只是看起来像纯文本,还是显示文字 HTML? -
我猜 $text 是 HTML 内容?不过,我们可能需要查看 HTML 代码来提供帮助(此代码中没有生成 ,因此很难找出它为什么不起作用^^);一个疯狂的猜测:您的链接是绝对的(“example.com/blah.php"”而不是相对的(“/blah.php”)?
-
噢!犯了一个愚蠢的错误:点击这里错过了“http://”部分
-
应该将此作为答案发布 ^^
标签: php html email thunderbird