getSentMIMEMessage() 中缺少密件抄送字段

问题描述 投票:0回答:2

我正在尝试使用

phpmailer()
创建 MIME 消息。 一切正常,但当我读取 MIME 消息时,密件抄送字段丢失。

我正在使用以下技术来创建 MIME 消息。

$mail->preSend();
$mime = $mail->getSentMIMEMessage();

上述代码创建的 MIME 消息在其他一些应用程序中用于发送电子邮件。

TO 和 CC 字段工作正常,但 Bcc 字段丢失。

请告诉我哪里错了。

请告诉我您无法回答我的问题。 很高兴分享更多信息。

email phpmailer mime
2个回答
0
投票

呃,你确实知道BCC 是做什么的,不是吗? BCC 通常会被 MTA 删除,否则就不会盲目,而 PHPMailer 实际上就是一个 MTA。


0
投票

这是一个很老的问题,但我今天遇到了同样的问题。我们在软件 Group-Office 中使用 PHPMailer,我们希望获得完整的 MIME 以保存到已发送项目文件夹中。我做了一个覆盖,在调用 getSentMimeMessage(); 时添加了 BCC 标头;

您可以在这里查看代码:

https://github.com/Intermesh/groupoffice/commit/a41682671b9658653649c1cfd79688cdcf28b820

    /**
     * Returns the whole MIME message.
     * Includes complete headers and body.
     * Only valid post preSend().
     *
     * @see PHPMailer::preSend()
     *
     * @return string
     */
    public function getSentMIMEMessage()
    {
        $header = $this->MIMEHeader;

        // PHPMailer leaves BCC out of headers when using SMTP. We want this header for our sent items
        // source. So we append it here.
        if (
            (
                'sendmail' !== $this->Mailer && 'qmail' !== $this->Mailer && 'mail' !== $this->Mailer
            )
            && count($this->bcc) > 0
        ) {
            $header .= $this->addrAppend('Bcc', $this->bcc);
        }

        return static::stripTrailingWSP($header . $this->mailHeader) .
            static::$LE . static::$LE . $this->MIMEBody;
    }

我希望这可以帮助也遇到这个问题的人。

最诚挚的问候, 梅林

© www.soinside.com 2019 - 2024. All rights reserved.