我已经设置了一个多部分的 mime 电子邮件,其中包含一个文本区域和一个 html 版本的时事通讯区域。除了我的 iPhone,一切正常。它首先显示文本版本,然后是 HTML 版本。但我不知道为什么... :-/
这是PHP:
$to = $_POST['email'];
$subject = 'Test';
$bound_text = 'boundary42';
$headers = "From: sender@sender.net\r\n";
$headers .= "MIME-Version: 1.0\r\n"
. "Content-Type: multipart/mixed; boundary=\"$bound_text\"";
$message = file_get_contents('mime.file');
mail($to, $subject, $message, $headers);
文件内容:
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=boundary42
This is a message with multiple parts in MIME format.
--boundary42
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Text goes here
--boundary42
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org /TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="margin:0;padding:0;font-family: arial, 'Arial';">
html goes here
</body>
</html>
--boundary42--