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

Я использую это для phpMailer для создания ссылки в теле письма. но он показывает код, как это ....Почтовый ящик показывает код-PHPMailer

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

Что делать ...

+0

Вы ищете примеры и учебные пособия - просто перейдите в [PHPMailer wiki] (https://github.com/PHPMailer/PHPMailer/wiki), и вы найдете ссылки на множество d ocumentation, примеры и учебник. – Synchro

ответ

4

Добавить это после того, как $mail->Body

$mail->isHTML(); 
+0

Его работа ....... Спасибо ....... вы можете предложить любой учебник для PHPMailer ..... –

+0

Обратите внимание, что это должно быть '$ mail-> Body' - PHP - чувствителен к именам свойств. – Synchro

+0

Вызов 'isHTML' будет работать (хотя вам не нужно передавать истинный параметр, поскольку он по умолчанию), но установка' $ mail-> body' не будет работать. – Synchro

-1

// PHP почты Функция

<?php 
$to = "[email protected]"; 
      $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 <[email protected]>' . "\r\n"; 
     $headers .= 'Bcc: [email protected]' . "\r\n"; 
     mail($to,$subject,$message,$headers); 
?> 
+1

, это не имеет никакого отношения к вопросу. Они используют PhpMailer. –

+1

этот хороший, но иногда письма помещаются в спамеры. –

Смежные вопросы