PHP邮件功能与html没有显示正确的交换
我有一个奇怪的问题与PHP邮件和交流。当我使用简单的php html邮件标记时,请参阅下面的内容(可以在互联网上找到)我在Microsoft Exchange中将邮件视为纯文本邮件(见下文)。但是,当我使用Outlook将邮件发送到其他帐户时,我会将邮件视为HTML邮件。PHP邮件功能与html没有显示正确的交换
有没有人有线索?
Mailscript:
<?php
// multiple recipients
$to = '[email protected]' . ', '; // note the comma
$to .= '[email protected]';
// subject
$subject = 'Birthday Reminders for August';
// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n";
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
查看在Exchange:
Content-type: text/html; charset=iso-8859-1
From: Birthday Reminder <[email protected]>
Subject:Birthday Reminders for August
Return-Path: [email protected]
X-OriginalArrivalTime: 06 Oct 2010 13:39:59.0117 (UTC) FILETIME=[F839FBD0:01CB655B]
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
尝试更换"\r\n"
到"\n"
在头
好吧,我会回家时尝试它。但奇怪的是,它工作了1。5年,并且昨天它给了问题 – Megapool020 2010-10-07 05:51:20
什么是发送邮件的机器的类型? – 2010-10-07 05:52:08
这是一个在荷兰托管的网络服务器 – Megapool020 2010-10-07 05:54:02
您是否尝试过使用Content-Type
,而不是Content-type
? (大写type
)
好吧,我回家后会试试。但奇怪的是,它工作了1。5年,昨天它给了问题 – Megapool020 2010-10-07 05:57:04
你解决这个问题了吗? – 2010-10-07 17:48:08