我通过PHP从变量包括HTML代码发送到回波邮件功能。奇怪的是,这

<����}im�

显示了后弦..但我不下去了操纵。邮件功能(附件)的字符集是相同的HTML代码字符集。

有帮助吗?

解决方案

编码问题,也许它会尝试显示二进制码?

您要用htmlentities如果欧想显示HTML

  

//输出:一个 '报价' 是

     

粗体的回波

     

ヶ辆($ STR);

其他提示

这些角色可能是“垃圾”数据的字符串。根据其中的字符串是从这些角色来可能是:额外的TCP数据的HTML页面或HTML页面之后的文件中额外的数据,或者别人后的插座居然把这些字符在他们的HTML网页(也许他们的文件被意外损坏,或者由于某些其他原因)。

您可以考虑使用 htmlMimeMail 类用于处理电子邮件。这样就可以避免讨厌的电子邮件的内在。

这是我有问题..我使用的代码来自互联网来源,$体生成发票,这将电子邮件发送..这些字符在HTML源文件的末尾,但我不明白为什么地狱它们的存在:(

$to = 'email@email.com';
$subject = 'Invoice';
$random_hash = md5(date('r', time()));
$headers = "From: mymail@mymail.com\r\nReply-To: webmaster@example.com";
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
$body=rtrim(chunk_split(base64_encode($body))); 
//define the body of the message.
ob_start(); //Turn on output buffering
?>
--PHP-mixed-<?php echo $random_hash; ?> 
Content-Type: multipart/alternative; boundary="PHP-alt-<?php echo $random_hash; ?>"

--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit

Hello World!!!
This is simple text email message.

--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: 7bit

Text Emailu.

--PHP-alt-<?php echo $random_hash; ?>--

--PHP-mixed-<?php echo $random_hash; ?> 
Content-Type: text/html; charset="UTF-8"; name="faktura.html" 
Content-Transfer-Encoding: base64 
Content-Disposition: attachment 

<?php echo htmlentities($body); ?>
--PHP-mixed-<?php echo $random_hash; ?>--

<?php
//copy current buffer contents into $message variable and delete current output buffer
$message = ob_get_clean();
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top