php
  • phpmailer
  • 2012-10-09 91 views 1 likes 
    1

    我想使用点击电子邮件能够链接,但它不是在邮件通过PHP的邮件功能发送体现,下面是我的代码如何在PHP中使用邮件clickabe链接(HREF链接)

    $url = "<html><a href='www.google.com'>Link</a></html>"; 
    
    $message = "Hi test url ".$url." "; 
    
    $$headers = 'MIME-Version: 1.0' . "\r\n"; 
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
    $headers .= "From: Admin <[email protected]> \r\n"; 
    @mail('[email protected]',$subject,$message,$headers); 
    

    内容我从电子邮件中收到:

    Hi test url <html><a href='www.google.com'>Link</a></html> ##NEW## 
    
    +0

    删除\ r和检查 – Hkachhia

    回答

    2

    您似乎没有正确发送HTML邮件。通常我会推荐使用第三方PHP库,如SwiftMailer来简化这个过程。

    编辑:如果你仍然希望使用php的mail()函数,你必须正确指定标题。 This article可以提供帮助。

    1

    要phpmailler使用HTML:

    $mail->isHTML(true) 
    

    您查看documantation

    phpMailler

    相关问题