dongmei8511 2014-12-14 07:42
浏览 36
已采纳

如何使用CKEditor发送精确编辑的文本

I have created a contact me page that uses CK Editor to edit the content of the mail. I am using xampp/ localhost to test the mail. I want the mail to be exactly like i edit it in the editor

For example the bold part in editor doesnot show up bold in the mail it is sent as

<strong>SOMETHING IN BOLD</strong>

How do i use CK editor or any other so that the mail is sent as

SOMETHING IN BOLD

and not as shown above.

Thank you.

HTML Code

<form action="upload.php" method="post" style="height:100%">

                <input name="articleTitle" value="Title" maxlength="50" 
                id="articleTitle">

                <textarea name="article-body">
                    Compose your article...
                </textarea>

            <script>
                CKEDITOR.inline( 'article-body' );
            </script>

        <br>
                <input name="senderName" type="text" value="Name" maxlength="50" 
                id="name" class="textBox">

                <input name="senderEmail" value="Email address" maxlength="50" 
                id="email" class="textBox">

                <input name="abtyou" value="About Yourself" maxlength="150" 
                id="abtyou" class="textBox">

                <input type="submit" name="submit" class="button">

            </form>

PHP Code

<?php

    $thankYou="";   

if(isset($_POST["submit"])) {
    $recipient="zain.farid@live.com";
    $subject="New Guest Post";
    $sender=$_POST["senderName"];
    $senderEmail=$_POST["senderEmail"];
    $senderAbout=$_POST["abtyou"];
    $message=$_POST["article-body"];
    $title=$_POST["articleTitle"];

    $mailBody="Name: $sender
Email: $senderEmail
About Sender: $senderAbout
Title: $title

$message";

    mail($recipient, $subject, $mailBody, "From: $sender <$senderEmail>");

    $thankYou="Thank you! Your post has been submitted.";
}

?>
  • 写回答

1条回答 默认 最新

  • doucaishou0074 2014-12-14 07:48
    关注

    Looks like you're not sending an HTML-header with the email. Here you can see how you can do this: (example 3) http://www.w3schools.com/php/func_mail_mail.asp

    <?php
    
    if(isset($_POST["submit"])) {
        // ... email settings ...
    
        // Always set content-type when sending HTML email
        $headers = "MIME-Version: 1.0" . "
    ";
        $headers .= "Content-type:text/html;charset=UTF-8" . "
    ";
        $headers .= "From: $sender <$senderEmail>" . "
    ";
    
        mail($recipient, $subject, $mailBody, $headers);
    
        // ...
    }
    
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 itest不允许查看成绩怎么办
  • ¥15 高通安卓11提取完整线刷包软件,或者优博讯dt50顺丰刷机包
  • ¥20 C,有个译码器,换了信道就跑不出原来数据
  • ¥15 MIMIC数据库安装问题
  • ¥60 基于JTag协议开发Fpga下载器上位机,哪位大🐂有偿指导?
  • ¥20 全书网Java爬取数据
  • ¥15 怎么获取红包封面的原始链接,并且获取红包封面序列号
  • ¥100 微信小程序跑脚本授权的问题
  • ¥100 房产抖音小程序苹果搜不到安卓可以付费悬赏
  • ¥15 STM32串口接收问题