简体   繁体   中英

how to use clickabe link (href link) in php mail

i want to use click able link in email, but it is not reflecting in email sending through php mail function, below is my code

$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);

Content which i'm getting from email:

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

You don't seem to be sending HTML mail correctly. Usually I will recommend using a third-party PHP library, like SwiftMailer , to simplify the process.

Edit: If you still wish to use php's mail() function, you will have to specify the headers correctly. This article could help.

To use the HTML in phpmailler:

$mail->isHTML(true) 

You review the documantation

phpMailler

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM