【发布时间】:2022-01-26 12:53:00
【问题描述】:
我第一次遇到 phpmailer 的问题,有人知道为什么 phpmailer 会发送如下电子邮件吗?它以某种方式没有将电子邮件转换为 html contecn 我似乎无法弄清楚为什么会发生这种情况
no=reply@domain.com
6:16 PM (0 minutes ago)
to me
--b1_948b9a2ff8436cf0db01abf3e30c0373
Content-Type: text/plain; charset=us-ascii
Request information form was submitted, details are given below.
Name
Email
Mobile
State
Plans
Destination
Total Travellers
Travel Within
Comments
debojit
no@email.com
451-245-7845
Georgia
Bags packed, I'm ready to go!
France
9 people
6-9 months
werwer
Regards,
company name
--b1_948b9a2ff8436cf0db01abf3e30c0373
Content-Type: text/html; charset=us-ascii
<h4>Request information form was submitted, details are given below.</h4>
<br/>
<table border="1" style="width:100%">
<tbody>
<tr>
<td><b>Name</b></td>
<td><b>Email</b></td>
<td><b>Mobile</b></td>
<td><b>State</b></td>
<td><b>Plans</b></td>
<td><b>Destination</b></td>
<td><b>Total Travellers</b></td>
<td><b>Travel Within</b></td>
<td><b>Comments</b></td>
</tr>
<tr>
<td>debojit</td>
<td>no@email.com</td>
<td>451-245-7845</td>
<td>Georgia</td>
<td>Bags packed, I'm ready to go!</td>
<td>France</td>
<td>9 people</td>
<td>6-9 months</td>
<td>werwer</td>
</tr>
</tbody>
</table>
<br/><br/>
Regards,
<br/>
company name
--b1_948b9a2ff8436cf0db01abf3e30c0373--
这就是我发送邮件的方式
$mail = new Mail();
$mail->setFrom(senderemail);
$mail->addAddress(email);
$mail->addReplyTo($email);
$mail->subject($subject);
$mail->body($body);
//$mail->send();
if($mail->send()){
echo '<div class="alert alert-success" role="alert">Thanks for contacting us, we\'ll get back to you soon.</div>';
echo "<meta http-equiv='refresh' content='5;url=contact-us.php'>";
}else{
echo '<div class="alert alert-danger" role="alert">Some problem occurred, please <a href="contact-us.php">try again</a>.</div>';
echo "<meta http-equiv='refresh' content='5;url=contact-us.php'>";
}
}
我尝试添加 $mail->IsHTML(true);等等,但似乎没有任何效果,这里可能有什么问题?
【问题讨论】:
-
这能回答你的问题吗? PHPmailer sending HTML CODE
-
@Justinas 我也尝试了该帖子中的步骤,但它没有解决我的问题,这就是我创建此帖子的原因。我从来没有遇到过这个问题。
-
通过添加 smtp 登录详细信息对其进行排序