code:
$to = "salman.saifi4@gmail.com";
$subject = $subjects;
$txt = "Name:\t".strip_tags($name)."
"."Subject:\t".strip_tags($subject)."
"."Leave Date:\t".$leave_date."
"."Reason:\t".strip_tags($reason)."
".strip_tags("<a href='http://example.com/confirm.php'>Click Here If Leave Application Approve</a>")."
".strip_tags("<a href='http://example.com/not-confirm.php'>Click Here If Leave Application Not Approve</a>");
$headers = "Leave Application";
mail($to,$subject,$txt,$headers);
I am using simple mail function in php and I want to sent a link as I show in my $txt variable when I send email my link look like as I show below:
<a href='http://example.com/confirm.php'>click here if leave application approve</a>
<a href='http://example.com/not-confirm.php'>click here if leave application not approve</a>
But I want only the text inside the a href tag i.e. (click here if leave application approve) and (click here if leave application not approve) and when I click on the text it redirect me on the link as I have mention. So, How can I do this ?Please help me.
Thank You
You need to add following in headers :
$headers = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
And also, for Text:
$text = '<html><body>';
$text.= '<a href="http://example.com/confirm.php">click here if leave application approve</a>';
$text.= '<a href="http://example.com/not-confirm.php">click here if leave application not approve</a>';
$text.= '</body></html>';
This is how you can send html in mail. you can set your message in $message variable
$to = "salman.saifi4@gmail.com";
$subject = $subjects;
$message = "<a href='http://example.com/confirm.php'>click here if leave application approve</a>
<a href='http://example.com/not-confirm.php'>click here if leave application not approve</a>";
$headers = "MIME-Version: 1.0" . "
";
$headers .= "Content-type:text/html;charset=UTF-8" . "
";
$headers .= 'From: <webmaster@example.com>' . "
";
$headers .= 'Cc: myboss@example.com' . "
";
mail($to,$subject,$message,$headers);