2019-07-18 07:48 阅读 66


Using PHP-EWS (GarethP), I am attempting to setReplyTo like this:

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->setReplyTo(""); // <-- this is the 'ReplyTo' address I want to set.

But this does not have any affect, and the recipient is then replying to the sender/from address.

The Api callback shows:

'replyTo' => NULL,

Any ideas on how solve?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    douao1579 douao1579 2019-07-18 08:21

    Ah, I figured it out. For anyone else experiencing a similar issue, here is what I found.

    Within the MessageType.php file, the addReplyTo and setReplyTo functions are missing.

    Adding these in the same way as the setToRecipients, setCcRecipients and setBccRecipients functions solves the problem:

    public function addReplyTo($recipient)
            return parent::addReplyTo(ensureIsMailbox($recipient));
    public function setReplyTo($recipients)
            $this->replyTo = [ ];
            $recipients = ensureIsArray($recipients);
            foreach ($recipients as $recipient) {
            return $this;
    点赞 评论 复制链接分享