[英]Phpmailer sending email as plain text to emails
O am for the first time facing an issue with phpmailer, does anyone has any idea why phpmailer is sending email as follow?哦,我是第一次遇到 phpmailer 的问题,有谁知道为什么 phpmailer 发送 email 如下? it somehow not tonverting the email into html contecn i just cannot seem to figure out why this is happening
它以某种方式没有将 email 转换为 html 连接我似乎无法弄清楚为什么会这样
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--
this is how i send mails这就是我发送邮件的方式
$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'>";
}
}
I tried adding $mail->IsHTML(true);我尝试添加 $mail->IsHTML(true); etc but nothing seems to be working, what could be possible wrong here guys?
等等,但似乎没有任何效果,这里可能有什么问题吗?
This is complete fabrication that bears only minor resemblance to valid PHPMailer code – it's not even valid PHP?这是与有效的 PHPMailer 代码只有轻微相似之处的完整制造——它甚至不是有效的 PHP? Unless you're using a wrapper/subclass that you have not told us about?
除非你使用了一个你没有告诉我们的包装器/子类?
$mail = new Mail();
$mail->setFrom(senderemail);
$mail->addAddress(email);
$mail->addReplyTo($email);
$mail->subject($subject);
$mail->body($body);
The PHPMailer class is called PHPMailer
, not Mail
. PHPMailer class 被称为
PHPMailer
,而不是Mail
。 The subject is set using the Subject
property;主题是使用
Subject
属性设置的; there is no such method as subject()
.没有像
subject()
这样的方法。 Similarly, there is no such method as body()
;同样,也没有
body()
这样的方法; to set the body set the Body
property.设置 body 设置
Body
属性。 Overall it should be:总的来说应该是:
$mail = new PHPMailer();
$mail->setFrom($senderemail);
$mail->addAddress($email);
$mail->addReplyTo($email);
$mail->Subject = $subject;
$mail->Body = $body;
PHPMailer does not do any HTML conversion. PHPMailer 不做任何 HTML 转换。 It's entirely up to you to create the HTML that you will send as part of the message body, and you also have to tell it you're using HTML, like:
创建 HTML 完全取决于您,您将作为消息正文的一部分发送,并且您还必须告诉它您正在使用 HTML,例如:
$mail->isHTML();
$mail->Body = '<h1>Lovely HTML</h1>';
$mail->AltBody 'boring plain text';
All the docs and examples show you this, so perhaps you should give them a read.所有文档和示例都向您展示了这一点,因此也许您应该阅读它们。
The issue was solved by enabling smtp login details通过启用 smtp 登录详细信息解决了该问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.