【问题标题】:iPhone displays plain and html in newsletter emailiPhone 在时事通讯电子邮件中显示纯文本和 html
【发布时间】:2013-08-29 01:03:37
【问题描述】:

我设置了一个多部分的 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--

【问题讨论】:

    标签: iphone email mime


    【解决方案1】:

    MIME type to satisfy HTML, email, images and plain text?Mail multipart/alternative vs multipart/mixed

    您构建的是一个多部分/混合 容器,其中包含两个内容:文本和纯文本。对于混合,两者都渲染是正确的。

    您可能想要的是一个多部分/替代容器来容纳这两个东西。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-01
      • 1970-01-01
      • 2011-07-08
      • 2020-01-10
      • 2011-02-03
      • 2021-05-17
      相关资源
      最近更新 更多