如何将此邮件转换为HTML
$message =' Hello ' . $row['first_name'] . ' ' . $row['last_name'] . '
以下是您的登录信息:
Username: '.$row['username'].';
Password: '.$row['password'].';
我们建议您在登录后更改密码。
mail ($row[email], 'Login Information', $message, 'From: ' . $company . ' <' . $row['email'] . '>');
$sent = true;
喜欢这个:
$message ='
<*html>
<*head>
<*title>HTML email<*/title>
<*/head>
<*body>
<*div>Hello ' . $row['first_name'] . ' ' . $row['last_name'] . '<*/div>
<*p>John<*/p>
<*img src="image.png" alt="" >
<*/body>
<*/html>
';
答案 0 :(得分:0)
将Content-type:text/html;charset=UTF-8
添加到标题中,然后从html标记中删除*,例如
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= "From: <****@example.com>' . "\r\n";
$headers .= "Cc: ****@example.com' . "\r\n";
$message ="
<html>
<head>
<title>HTML email</title>
</head>
<body>
<div>Hello " . $row['first_name'] . " " . $row['last_name'] . "</div>
<p>John</p>
<img src='image.png' alt='' >
</body>
</html>
";
mail("tomailid","subject",$message,$headers);