繁体   English   中英

PHP-EWS(GarethP)setReplyTo

[英]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);

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

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;
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM