I am trying to send mail from PHP using my yahoo credentials.
$Mbody=$Mbody."<body>";
$Mbody=$Mbody."<table border=0>";
$Mbody=$Mbody."<tr>";
$Mbody=$Mbody."<td>Hi,</td>";
$Mbody=$Mbody."</tr>";
$Mbody=$Mbody."<tr>";
$Mbody=$Mbody."<td>New Mail for testing.</td>";
$Mbody=$Mbody."</tr>";
$Mbody=$Mbody."<tr>";
$Mbody=$Mbody."<td><a href=http://www.google.com >Verify Account</a></td>";
$Mbody=$Mbody."</tr>";
$Mbody=$Mbody."</table>";
$Mbody=$Mbody."</body>";
$Mbody=$Mbody."</html>";
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl";
$mail->Host = "plus.smtp.mail.yahoo.com";
$mail->Port = 465; // set the SMTP port
$mail->Username = "********";
$mail->Password = "********";
$mail->From = "********";
$mail->FromName = "my Name";
$mail->AddAddress('********');
$mail->Subject = "Subject";
$mail->Body = $Mbody;
When I execute the code, it does send mail to desired recipient, but the body shows all HTML tag in the received mail. What is missing in above code.
请使用内容类型作为HTML
$mail->IsHTML(true); // send as HTML
Try This
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Subject';
$mail->MsgHTML($Mbody);
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
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.