我对PHPMailer包有问题
我正在尝试从PHPMailer发送电子邮件。一切正常,但问题是即使在编写我对PHPMailer包有问题,php,forms,styles,coding-style,phpmailer,Php,Forms,Styles,Coding Style,Phpmailer,我正在尝试从PHPMailer发送电子邮件。一切正常,但问题是即使在编写$mail->IsHTML(true)之后,它仍在发送带有HTML标记的电子邮件。下面是我发送电子邮件的代码 <?php session_start(); if ($_POST['Submit'] == 'Send') { if (strcmp(md5($_POST['user_code']),$_SESSION['ckey'])) { header("Location: sendmail.php?msg
$mail->IsHTML(true)
之后,它仍在发送带有HTML标记的电子邮件。下面是我发送电子邮件的代码
<?php
session_start();
if ($_POST['Submit'] == 'Send')
{
if (strcmp(md5($_POST['user_code']),$_SESSION['ckey']))
{
header("Location: sendmail.php?msg=ERROR: Invalid Verification Code");
exit();
}
$to = $_POST['toemail'];
$subject = $_POST['subject'];
$message = $_POST["message"];
$message = isHTML(true);
$fromemail = $_POST['fromemail'];
$fromname = $_POST['fromname'];
$lt= '<';
$gt= '>';
$sp= ' ';
$from= 'From:';
$headers = "From: $from\r\n";
$headers .= "Content-Type: text/html\r\n";
mail($to,$subject,$message,$headers);
header("Location: sendmail.php?msg= Mail Sent!");
exit();
首先,您应该检查服务器的设置
尝试使用mail('您的_email@test.com'测试','xyz') 您正在覆盖$message变量<代码>$message=$\u POST[“message”]$消息=isHTML(真)代码>。更好的用户PHPMailer库您没有使用PHPMailer,您在这里使用的是PHP自己的原生邮件函数。:请勿使用!此标记引用了一个完全固执己见的主题,因此不再是主题。我尝试使用此$headers.=“MIME版本:1.0\r\n”$标题。=“内容类型:text/html;\r\n”;它的工作,但我保留用户34213123的电子邮件