没有显示电子邮件内容

问题描述:

我的PHP应用程序发送的邮件有问题。没有显示电子邮件内容

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

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

对此的任何其他想法将是伟大的!

你说所有的电子邮件都是用HTML发送的。您可能需要发送纯文本才能使用它 - 以满足那些不支持HTML的电子邮件客户端。 http://www.webcheatsheet.com/PHP/send_email_text_html_attachment.php

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

<?php 
//define the receiver of the email 
$to = '[email protected]'; 
//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: [email protected]\r\nReply-To: [email protected]"; 
//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"; 
?> 
+0

好,谢谢您的回复,我可以确认的电子邮件已经发出这样的,并会dislpay在任何一个文本或HTML确定。这是我尝试的第一件事情之一:s – mic 2012-01-03 10:05:28