0

使用 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);

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

Api 回调显示:

'replyTo' => NULL,

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

4

1 回答 1

0

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

在该MessageType.php文件中,缺少addReplyTo和函数。setReplyTo

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

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;
    }
于 2019-07-18T08:21:42.897 回答