通过MSGraph PHP SDK生成回复电子邮件
我正在重建一个基于EWS的系统,以使用Microsoft Graph REST API,我在复制EWS实现中的回复电子邮件功能时遇到问题通过MSGraph PHP SDK生成回复电子邮件,php,laravel,microsoft-graph-api,Php,Laravel,Microsoft Graph Api,我正在重建一个基于EWS的系统,以使用Microsoft Graph REST API,我在复制EWS实现中的回复电子邮件功能时遇到问题 使用EWS,我将创建一个ReplyToItemType,指定原始电子邮件并附加NewBodyContent,如下所示: $reply = new ReplyToItemType(); $reply->ReferenceItemId = new ItemIdType(); $reply->ReferenceItemId->Id = $thi
使用EWS,我将创建一个
ReplyToItemType
,指定原始电子邮件并附加NewBodyContent
,如下所示:
$reply = new ReplyToItemType();
$reply->ReferenceItemId = new ItemIdType();
$reply->ReferenceItemId->Id = $this->message->ItemId->Id;
$reply->ReferenceItemId->ChangeKey = $this->message->ItemId->ChangeKey;
$reply->NewBodyContent = new BodyType();
$reply->NewBodyContent->BodyType = BodyTypeType::HTML;
$reply->NewBodyContent->_ = $this->body;
这将创建一封新邮件,其中包含已附加的上一封电子邮件的内容,并设置主题(即“RE:原始主题”
)
使用MSGraph,我似乎无法复制此功能 我正在使用
POST/users/{id | userPrincipalName}/messages/{id}/reply
端点(因此在URL中指定要回复的消息):
请求主体,$body
,如下所示:
array:1 [
"Message" => array:6 [
"sender" => array:1 [
"emailAddress" => array:1 [
"address" => "sender@domain.co.uk"
]
]
"toRecipients" => array:1 [
0 => array:1 [
"emailAddress" => array:1 [
"address" => "recipient@domain.co.uk"
]
]
]
"ccRecipients" => []
"attachments" => []
"body" => array:2 [
"contentType" => "html"
"content" => "<p>Test</p>"
]
"subject" => "null"
]
]
数组:1[
“消息”=>数组:6[
“发送方”=>数组:1[
“emailAddress”=>数组:1[
“地址”=>“sender@domain.co.uk"
]
]
“toRecipients”=>数组:1[
0=>数组:1[
“emailAddress”=>数组:1[
“地址”=>“recipient@domain.co.uk"
]
]
]
“ccRecipients”=>[]
“附件”=>[]
“body”=>数组:2[
“contentType”=>“html”
“内容”=>“测试”
]
“主题”=>“空”
]
]
但这会发送一封主题为“null”且内容为:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<p>test</p>
</body>
</html>
试验
是否有任何方法可以复制上述EWS功能,而不必手动附加以前的电子邮件内容和主题?您需要使用。将其设置为文本字符串,它将成为回复消息的顶部,原始消息中引用的文本将如您所料显示在下面。谢谢,这确实有效。我以为我以前试过这个,但我一定是错误地构造了请求。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<p>test</p>
</body>
</html>