1

前段时间,我创建了一个发送 MIME 编码电子邮件的 PHP 脚本。它工作正常,包含附件和内联图像。奇怪的是,这些电子邮件并没有出现在我的 iPod Touch(第 3 代,iOS 5.1.1)的收件箱中,尽管它们出现在 Windows Live Mail、GMail 和更高版本的 iPad/iPhone 中。我已经将原始消息的来源与 GMail 转发的原始消息进行了比较(因为转发的消息不会被我的 iPod 识别)。MIME 结构似乎没有任何区别。

有人知道是否必须有特定的 To、From、Subject、...-headers 序列才能使其正常工作?这是一条示例消息:

[BLADIBLADIBLA]

Date: Wed, 7 Aug 2013 13:02:31 +0000
To: Name <email@domain.com>
Subject: Test 5
X-PHP-Originating-Script: 0:email.php
MIME-Version: 1.0
From: Name <email@domain.com>
Reply-To: Name <email@domain.com>
Content-Type: multipart/mixed; boundary=boundMixed
--boundMixed
    Content-Type: multipart/related; boundary=boundRelated

    --boundRelated
        Content-Type: multipart/alternative; boundary=boundAlternative

        --boundAlternative
            Content-Type: text/plain; charset=utf-8
            Content-Transfer-Encoding: 7-bit

            [PLAIN TEXT]

        --boundAlternative
            Content-Type: text/html; charset=utf-8
            Content-Transfer-Encoding: 7-bit

            [HTML]

        --boundAlternative--

    --boundRelated
        Content-Type: image/png; name="logo.png"
        Content-Transfer-Encoding: base64
        Content-ID: <logo.png@domain.com>

        [INLINE IMAGE DATA]

    --boundRelated--

--boundMixed
    Content-Type: text/plain; name="file.txt"
    Content-Disposition: attachment; filename="file.txt"
    Content-Transfer-Encoding: base64

    [ATTACHMENT DATA]

--boundMixed--

为了清楚起见,我用人类可读的东西替换了边界哈希。我还打算让不同的部分更具可读性;这不是真实数据的情况!

PHP mail() 函数可能有问题吗?或者是否有关于边界后换行数的严格规定?

提前致谢!

4

0 回答 0