2
$mail->body = "<a href="www.example.com/register">Click here</a>";

I am used this for a phpMailer to create a link in mail body. but it shows the code like this....

<a href="www.example.com/register">Click here</a>

What to do...

Sathish Kumar D
  • 294
  • 6
  • 18
  • You're looking for examples and tutorials - just go to [the PHPMailer wiki](https://github.com/PHPMailer/PHPMailer/wiki) and you'll find links to lots of documentation, examples and a tutorial. – Synchro Aug 06 '15 at 11:33

2 Answers2

4

Add this after $mail->Body

$mail->isHTML(); 
Synchro
  • 29,823
  • 14
  • 69
  • 85
Abdulla Nilam
  • 29,776
  • 14
  • 53
  • 77
-1

//PHP Mail Function

<?php
$to = "email@youremail.com";
            $subject = "Subject Should be here";
            $message="<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Welcome to Company Name!</title>
</head>

<body>
<div class='wrapper'>
    <div class='logo' style='margin-left:150px; margin-top:20px; float:left;'><a href='".$website."'><img src='".$website."images/logo.png' width='150'></a></div>
    <div class='msgtype' style='color: #fff;
    font-family: Arial,Helvetica,sans-serif;
    font-size: 30px;
    margin-left: 310px;
    margin-top: -82px; float:left;
    width: 500px;'>
    Welcome to Matchless Property.com ".$fullname."! 
    </div><div style='clear:both;'></div>
    <div class='ondate' style='margin-left:150px; margin-top:10px; font-family:Arial, Helvetica, sans-serif; color:#999; font-size:14px;'>".$date."</div>
    <div class='box' style='background-color:#eeeeee; margin-top:20px;'>
        <div class='note' style='margin-left:150px; padding-top:20px; font-family:Arial, Helvetica, sans-serif; font-size:28px; color:#333; width:650px; padding-bottom:20px;'>
        Welcome to Matchless Property! 
        </div>
        <div style='font-family:Arial, Helvetica, sans-serif; font-size:18; color:#666; margin-left:150px; margin-bottom:20px;'>
            <div>Hi, ".$fullname." Here it is notification mail from Matchless Property. Please verify your link below.</div>
        </div>
        <div class='forgotpassword' style='background-color: #33CCFF; padding: 6px 20px; width:85px; margin-bottom:20px; margin-left:130px;'>
            <a href='".$website."verification.php?uida56sdf4sd4f568er14dfv1=".$userRec['id']."' style='color: #FFFFFF;
    font-family: Arial,Helvetica,sans-serif;
    font-size: 18px;
    line-height: 28px;
    text-decoration: none;'>Click Here</a>
        </div>
        <div class='quitenote' style='margin-left:150px; padding-top:20px; font-family:Arial, Helvetica, sans-serif; font-size:18px; color:#333; width:650px; padding-bottom:20px;'>
        You can now post ad and features! We are happy you are here.
        </div>
    </div>
    <div class='footer' style='background-color:#333; color:#999; font-family:Arial, Helvetica, sans-serif; padding:20px; text-align:center; font-size:12px;'>
        <a href='".$website."' style='color:#999; text-decoration:none;'>© Matchless Property</a> &nbsp;&nbsp;&nbsp;&nbsp;<a href='".$website."terms.php' style='color:#999; text-decoration:none;'>Terms & conditions</a> &nbsp;&nbsp;&nbsp;&nbsp;<a href='".$website."privacy.php' style='color:#999; text-decoration:none;'>Privacy policy</a> &nbsp;&nbsp;&nbsp;&nbsp;<a href='http://www.dimensionsxpert.com' style='color:#999; text-decoration:none;'>Dimensions Xpert</a> &nbsp;&nbsp;&nbsp;&nbsp;<a href='".$website."contact.php' style='color:#999; text-decoration:none;'>Contact us</a>
    </div>
</div>
</body>
</html>";

        // Always set content-type when sending HTML email
        $headers = "MIME-Version: 1.0" . "\r\n";
        $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

        // More headers
        $headers .= 'From: Company Name  <no-reply@matchlessproperty.com>' . "\r\n";
        $headers .= 'Bcc: yourname@youremail.com' . "\r\n";
        mail($to,$subject,$message,$headers);
?>
Hassan Ali
  • 45
  • 4