包含的PHP和CKEditor图像未显示在电子邮件中

时间:2016-05-30 14:21:59

标签: javascript php ckeditor

我有以下页面发送简讯。

page

当我从工具栏图标中包含图像时。它可以实时显示。但是,当我点击发送时,电子邮件会收到没有图像的消息。只是消息(编辑器的格式化文本显示正确)

我的图片位于以下网址:http://raveen.comlu.com/sport.jpg

我也会在发送消息后打印编辑器制作的内容; 即便如此,图片也不会显示在页面上(见截图)

screenshot

我有以下代码;

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title> A simple page with CKEditor </title>
    <script src="ckeditor/ckeditor.js"> </script>
</head>

<body>
    <form method="post" action="">
        <!-- Create a <textarea> element first -->
        <textarea name="editor1" id="editor1" rows="10" cols="80">
            This is my textarea to be replaced with CKEditor.
        </textarea>

        <script>
            //replace the <textarea id="editor1"> with a CKEditor instance
            CKEDITOR.replace( 'editor1' );

            //Retrieve data from CKEditor instance with ID of editor1
            var data = CKEDITOR.instances.editor1.getData()

        </script>

        <input type="submit" name="btnSubmit" value="Send">
    </form>

    <?php
        if( isset($_POST['btnSubmit']) ){

            $editor_data = $_POST['editor1'];
            echo $editor_data;


            $to = "receiver1@yahoo.com, receiver2@gmail.com";
            $subject = "Here is the subject";

            $message = $editor_data;

            $header = "From: Sender Name <senderemail@gmail.com> \r\n";

            $header .= "MIME-Version: 1.0 \r\n";
            $header .= "Content-type:text/html;charset=UTF-8 \r\n";

            $retval = mail( $to, $subject, $message, $header );

            if( $retval == true ){
                echo "Message sent successfully";
            }
            else{
                echo "Message could not be sent!";
            }
        }
    ?>

</body>

1 个答案:

答案 0 :(得分:2)

您的编辑器数据中的所有引号都被转义,因此您可以尝试在$editor_data = stripslashes($editor_data); 之前添加此行

public class initial {


    public static void main(String[] args) {

        String prn = disp();
        System.out.println(prn);
    }

    public static String disp()
        {
        String str=" JAVARANCH ";
        return str;
    }
}