簡體   English   中英

如何在php郵件中使用clickabe鏈接(href鏈接)

[英]how to use clickabe link (href link) in php mail

我想在電子郵件中使用點擊鏈接,但它沒有反映在通過php郵件功能發送的電子郵件中,下面是我的代碼

$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 <test@ex.com> \r\n";
@mail('test1@ex.com',$subject,$message,$headers);

我從電子郵件中收到的內容:

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

您似乎沒有正確發送HTML郵件。 通常我會建議使用第三方PHP庫,如SwiftMailer ,以簡化流程。

編輯:如果您仍希望使用php的mail()函數,則必須正確指定標題。 這篇文章可以幫助你。

要在phpmailler中使用HTML:

$mail->isHTML(true) 

您查看了文檔

phpMailler

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM