PHP-TO (GarethP) setReplTo

PHP-EWS (GarethP) setReplyTo

使用 PHP-EWS (GarethP),我正在尝试 setReplyTo 像这样:

use garethp\ews\API\Type;
use garethp\ews\MailAPI;

$api = MailAPI::withUsernameAndPassword("host", "username", "password");
$message = new Type\MessageType();
$message->setSubject("Some Subject");
$message->setBody("Test Email");
$message->setToRecipients("test@test.com");
$message->setReplyTo("me@there.com"); // <-- this is the 'ReplyTo' address I want to set.
$api->sendMail($message);

但这没有任何影响,收件人随后正在回复sender/from地址。

Api回调显示:

'replyTo' => NULL,

关于如何解决的任何想法?

啊,我想通了。 对于遇到类似问题的任何其他人,这是我发现的。

MessageType.php 文件中,缺少 addReplyTosetReplyTo 函数。

以与setToRecipientssetCcRecipientssetBccRecipients 函数相同的方式添加这些可以解决问题:

public function addReplyTo($recipient)
    {
        return parent::addReplyTo(ensureIsMailbox($recipient));
    }
public function setReplyTo($recipients)
    {
        $this->replyTo = [ ];
        $recipients = ensureIsArray($recipients);

        foreach ($recipients as $recipient) {
            $this->addReplyTo($recipient);
        }

        return $this;
    }