PHP中的html邮件程序 - NicEdit图像从邮件中删除

PHP中的html邮件程序 -  NicEdit图像从邮件中删除

问题描述:

I'm writing a program to send html embedded mail. For this purpose I've used NicEdit - WYSIWYG editor. When I do send a mail, the images disappears in the mail.

In php mail() I've used headers as:

$header="From: no-reply@prithviassociates.org
X-Mailer: PHP/".phpversion()."
".
        "MIME-Version: 1.0
Content-type: text/html; charset: utf8
".
        "Reply-To: info@prithviassociates.org
Bcc: ".$recipients."
";

where $recipients contains the email addresses of recipients.

Any solution of this problem?

Code

NicEdit Configuration

<script src="js/nicedit.js"></script>
<script>
    $(document).ready(function() {
        new nicEditor().panelInstance('message');
    });
</script>

HTML mailer form

<form method="post" action="mailProcess.php">
    To <input type="text" name="recipients">
    Subject <input type="text" name="subject">
    Message
    <textarea cols="70" rows="15" name="message" id="message"></textarea>
</form>

mailProcess.php

$recipients = $_POST['recipients'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$header = "From: no-reply@prithviassociates.org
X-Mailer: PHP/" . phpversion() . "
" .
        "MIME-Version: 1.0
Content-type: text/html; charset: utf8
" .
        "Reply-To: info@prithviassociates.org
Bcc: " . $recipients . "
";

If I do upload an image then NicEdit gives a link like <img width="524" src="http://i.imgur.com/ycyrMau.jpg"></img> and when I submit the form for mailing the image disappears from the mail message

我正在编写一个程序来发送 html code>嵌入式邮件。 为此,我使用了 NicEdit - WYSIWYG编辑器。 当我发送邮件时,图像会在邮件中消失。 p>

在php mail() code>中我使用 headers code>作为 : p>

  $ header =“From:no-reply@prithviassociates.org 
 
X-Mailer:PHP /”。phpversion()。“
 
”。  
“MIME-Version:1.0 
 
Content-type:text / html; charset:utf8 
 
”。
“回复:info@prithviassociates.org 
 
Bcc:”。$收件人。  “
 
”; 
  code>  pre> 
 
 

其中 $ recipients code>包含收件人的电子邮件地址。 p> 此问题的任何解决方案? p>

代码 strong> p>

NicEdit配置 em> p >

 &lt; script src =“js / nicedit.js”&gt;&lt; / script&gt; 
&lt; script&gt; 
 $(document).ready(function(){
  new nicEditor()。panelInstance('message'); 
}); 
&lt; / script&gt; 
  code>  pre> 
 
 

HTML邮件表格 em> p>

 &lt; form method =“post”action =“mailProcess.php”&gt; 
要&lt; input type =“text”name =“recipients”&gt; \  n主题&lt; input type =“text”nam  e =“subject”&gt; 
消息
&lt; textarea cols =“70”rows =“15”name =“message”id =“message”&gt;&lt; / textarea&gt; 
&lt; / form&gt; 
   code>  pre> 
 
 

mailProcess.php em> p>

  $ recipients = $ _POST ['recipients'];  
 $ subject = $ _POST ['subject']; 
 $ message = $ _POST ['message']; 
 $ header =“From:no-reply@prithviassociates.org 
 
X-Mailer:PHP /  “。  phpversion()。  “
 
”。
“MIME-Version:1.0 
 
Content-type:text / html; charset:utf8 
 
”。
“回复:info@prithviassociates.org 
 \  nBcc:“。  $ recipients。  “
 
”; 
  code>  pre> 
 
 

如果我确实上传了图片,那么 NicEdit code>会给出一个类似&lt; img width的链接 =“524”src =“http://i.imgur.com/ycyrMau.jpg”&gt;&lt; / img&gt; code>当我提交邮寄表单时,图片将从邮件邮件中消失 code> p> div>

With the help of gmail I'm able to tackle with this problem.

In gmail (standard view) I found Message text garbled? which showed me the actual content of the mail, which was in my case: <img src=\"http://i.imgur.com/CvToS30.jpg\" width=\"176\">. It contains \s before every " which I've removed from stripslashes() as:

$message = stripslashes($_POST['message']);

and now it works.

Have you checked your mail logs? Is there any link to an image or error of some sort?