[英]PHP and CKEditor included image does not show in the email
I have the following page to send newsletters. 我有以下页面发送新闻通讯。
When I include an image from the toolbar icon. 当我包含来自工具栏图标的图像时。 It displays correctly realtime.
它可以正确实时显示。 But however when I click Send, email gets the message without the image.
但是,当我单击“发送”时,电子邮件会收到没有图像的消息。 Just only the message (formatted text by the editor shows correctly)
仅消息(编辑器格式化的文本正确显示)
My image is located in this URL: http://raveen.comlu.com/sport.jpg 我的图片位于以下URL: http : //raveen.comlu.com/sport.jpg
Also I print content made by the editor after sending message as well; 同样,在发送消息后,我也会打印编辑者制作的内容; Even there also, image does not show on the page(see screenshot)
即使在那里,图像也不会显示在页面上(请参见屏幕截图)
I have the following code; 我有以下代码;
<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>
编辑器数据中的所有引号均被转义,因此您可以尝试在echo $editor_data;
之前添加此行echo $editor_data;
$editor_data = stripslashes($editor_data);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.