Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 通过SMTP和tinymce发送电子邮件以写入内容时如何隐藏HTML标记_Php_Html_Email_Smtp - Fatal编程技术网

Php 通过SMTP和tinymce发送电子邮件以写入内容时如何隐藏HTML标记

Php 通过SMTP和tinymce发送电子邮件以写入内容时如何隐藏HTML标记,php,html,email,smtp,Php,Html,Email,Smtp,我只想给买了东西的顾客发电子邮件。。。 我使用SMTP和PHP发送,但在SMTP代码中,我定义了从使用tinymce的文本区域接收的电子邮件内容。一切正常,它发送电子邮件,但在发送的电子邮件中,有HTML标记用于在tinymce编辑器中编写内容…这些标记应被视为HTML标记而不是字符串…我在SMTP代码中设置了与HTML相关的所有内容(如下图所示),但这不起作用 ` 在标题中将内容类型设置为文本/html。即$mail->IsHTML(true)将标题中的内容类型设置为文本/html。即$mai

我只想给买了东西的顾客发电子邮件。。。 我使用SMTP和PHP发送,但在SMTP代码中,我定义了从使用tinymce的文本区域接收的电子邮件内容。一切正常,它发送电子邮件,但在发送的电子邮件中,有HTML标记用于在tinymce编辑器中编写内容…这些标记应被视为HTML标记而不是字符串…我在SMTP代码中设置了与HTML相关的所有内容(如下图所示),但这不起作用

`


在标题中将
内容类型设置为
文本/html
。即
$mail->IsHTML(true)

将标题中的
内容类型设置为
文本/html
。即
$mail->IsHTML(true)

我刚用了
htmlspecialchars\u decode()
我刚用了
htmlspecialchars\u decode()

对不起,如果你看到我的代码,我就把它设置成
$mail->isHTML(true)
!这不会让人担心,但如果你看到我的代码,我就设置它
$mail->isHTML(true)
!那是行不通的
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="post">
    <div class="form-group">
        <label for="subject">subject</label>
        <input type="text" id="subject" name="subject" class="form-control" />
    </div>
    <div class="form-group">
        <label for="msg">content</label>
        <textarea id="msg" name="msg" class="form-control"></textarea>
    </div>
    <input type="submit" value="send" class="btn btn-success" name="submit"/>
   </form>    
$q = 'SELECT * FROM Users';
    $re = $conn->query($q);
    $row = $re->fetch_assoc();
    while($row = $re->fetch_assoc()){
    require_once 'phpMailer5/class.phpmailer.php';
    require_once 'phpMailer5/class.smtp.php';
    $mail = new PHPMailer();
    $mail->isSMTP();
    $mail->Host = 'localhost';
    $mail->Username = 'etc@example.etc';
    $mail->Password = 'something';
    $mail->Subject  = xss_clean($_POST['subject']);
    //$mail->SMTPDebug = 2;
    $mail->Debugoutput = 'html';
    $mail->SMTPAuth = true;
    $mail->CharSet = 'UTF-8';
    $mail->AddBCC($row['email'],$row['name']);
    $mail->isHTML(true);
    //$mail->MsgHTML(stripslashes(stripslashes(xss_clean($_POST['msg']))));
    $mail->Body = stripslashes(stripslashes(xss_clean($_POST['msg'])));
    $mail->AltBody = xss_clean($_POST['msg']);
    $mail->setFrom('no-reply@example.etc','Mahyar Ansary');
    if(!$mail->Send()){
        echo '<div class="alert alert-danger">'.$mail->ErrorInfo.'</div>';
    }
    else{
        echo '<div class="alert alert-success">sent</div>';
    }