使用php-ews回复电子邮件
作者:互联网
我正在使用php-ews阅读交换邮箱.但是,我想从收件箱中选择一封电子邮件并回复该电子邮件,并附上电子邮件历史记录并发送回复.以下是我用于从收件箱中获取特定电子邮件的代码.
$ews = new ExchangeWebServices($account_array['server'], $account_array['username'], $account_array['password'], ExchangeWebServices::VERSION_2010_SP1);
$message_id = 'AAMkADU3ZDdmZmY3LWI3OGMtNDRmMy1hYTdlLTBlZjkwOGE3NTU5MwBGAAAAAADkJRKCdlaES7sRqf3veO/UBwCgoREk6zyqQqi6KC/gJMy0AAAAvGoCAACgoREk6zyqQqi6KC/gJMy0AAAAvGpQAAA=';
$change_id = 'CQAAABYAAACgoREk6zyqQqi6KC/gJMy0AAAAvMEZ';
$request = new EWSType_GetItemType();
$request -> ItemShape = new EWSType_ItemResponseShapeType();
$request -> ItemShape -> BaseShape = EWSType_DefaultShapeNamesType::ALL_PROPERTIES;
$request -> ItemShape -> BodyType = EWSType_BodyTypeResponseType::HTML;
$body_property = new EWSType_PathToUnindexedFieldType();
$body_property -> FieldURI = 'item:Body';
$request -> ItemShape -> AdditionalProperties = new EWSType_NonEmptyArrayOfPathsToElementType();
$request -> ItemShape -> AdditionalProperties -> FieldURI = array($body_property);
$request -> ItemIds = new EWSType_NonEmptyArrayOfBaseItemIdsType();
$request -> ItemIds -> ItemId = array();
$message_item = new EWSType_ItemIdType();
$message_item -> Id = trim($message_id);
$request -> ItemIds -> ItemId[] = $message_item;
$response = $ews -> GetItem($request);
//print '<pre>' . print_r($response, true) . '</pre><hr/>';
$message = $response -> ResponseMessages -> GetItemResponseMessage -> Items -> Message;
print '<pre>' . print_r($message, true) . '</pre><hr/>';
现在我已收到要回复的消息,如何进一步采取此措施并起草回复消息并为此电子邮件创建回复项目.
我在谷歌搜索过这个,但没有运气.
钻进php-ews类几个小时,我看了EWSType_ReplyAllToItemType,EWSType_PostReplyItemType,EWSType_PostReplyItemBaseType等,但无法理解如何使用这些代码.
请帮帮我们!任何帮助将不胜感激.
我确信任何对这篇文章的回复都会有所帮助,因为没有论坛在讨论
对这个.
标签:php,email,exchangewebservices,email-integration,php-ews 来源: https://codeday.me/bug/20190625/1286331.html