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,

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


猛跑小猪
浏览 172回答 1
1回答

GCT1015

啊,我想通了。对于遇到类似问题的其他人,这是我发现的。在MessageType.php文件中,缺少addReplyTo和setReplyTo函数。以与setToRecipients,setCcRecipients和setBccRecipients函数相同的方式添加这些可以解决问题:public function addReplyTo($recipient)&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; return parent::addReplyTo(ensureIsMailbox($recipient));&nbsp; &nbsp; }public function setReplyTo($recipients)&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; $this->replyTo = [ ];&nbsp; &nbsp; &nbsp; &nbsp; $recipients = ensureIsArray($recipients);&nbsp; &nbsp; &nbsp; &nbsp; foreach ($recipients as $recipient) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this->addReplyTo($recipient);&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; return $this;&nbsp; &nbsp; }
打开App,查看更多内容
随时随地看视频慕课网APP