Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 电子邮件内容不显示_Php_Email_Html Email - Fatal编程技术网

Php 电子邮件内容不显示

Php 电子邮件内容不显示,php,email,html-email,Php,Email,Html Email,我对PHP应用程序发送的一些电子邮件有问题 收到的电子邮件是空白的,它们都被发送到一个特定的地址。这些电子邮件也被抄送到我控制的地址,并且它们都被正确接收。所有电子邮件都以HTML格式发送 我无法控制这些电子邮件发送到的远程电子邮件地址,但我100%确信它们会通过某种M$exchange垃圾邮件过滤器。是否是过滤器导致数据丢失 如果你还有其他想法,那就太好了 你说所有电子邮件都是用HTML发送的。为了迎合那些不支持HTML的电子邮件客户,你可能需要发送纯文本 这是上面链接的复制粘贴: <?

我对PHP应用程序发送的一些电子邮件有问题

收到的电子邮件是空白的,它们都被发送到一个特定的地址。这些电子邮件也被抄送到我控制的地址,并且它们都被正确接收。所有电子邮件都以HTML格式发送

我无法控制这些电子邮件发送到的远程电子邮件地址,但我100%确信它们会通过某种M$exchange垃圾邮件过滤器。是否是过滤器导致数据丢失


如果你还有其他想法,那就太好了

你说所有电子邮件都是用HTML发送的。为了迎合那些不支持HTML的电子邮件客户,你可能需要发送纯文本

这是上面链接的复制粘贴:

<?php
//define the receiver of the email
$to = 'youraddress@example.com';
//define the subject of the email
$subject = 'Test HTML email';
//create a boundary string. It must be unique
//so we use the MD5 algorithm to generate a random hash
$random_hash = md5(date('r', time()));
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: webmaster@example.com\r\nReply-To: webmaster@example.com";
//add boundary string and mime type specification
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"";
//define the body of the message.
ob_start(); //Turn on output buffering
?>
--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

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

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

<h2>Hello World!</h2>
<p>This is something with <b>HTML</b> formatting.</p>

--PHP-alt-<?php echo $random_hash; ?>--
<?
//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 );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 
echo $mail_sent ? "Mail sent" : "Mail failed";
?>

--PHP alt-
内容类型:文本/纯文本;charset=“iso-8859-1”
内容传输编码:7bit
你好,世界!!!
这是一封简单的短信。
--PHP alt-
内容类型:text/html;charset=“iso-8859-1”
内容传输编码:7bit
你好,世界!
这是HTML格式的东西

--PHP alt---
好的,谢谢你的回复,我可以确认邮件已经像这样发送了,并且会以文本或HTML的形式显示ok。这是我尝试的第一件事:s