I am trying to send an email using modern smtp with Office365 Graph API. Emails are sending fine, with attachments however, I cannot seem to fullfill the response I’m expecting from the endpoint.
$this->graphSdk->createRequest("POST", "/users/" . $this->config['from_email'] . "/sendmail")
->attachBody($this->getMessageBody($message))
->setReturnType(Message::class)
->execute()
The response when I dump and die is the following (the email successfully sends and I receive it):
MicrosoftGraphModelMessage {#4623
#_propDict: []
}
I need to obtain both the message ID and conversation ID from this but I cannot seem to find any source of help from the documentation other than adding the associated return type which I have as the expected Message
, any help appreciated.
2
Answers
Microsoft Graph API does not return the message object or any response by default. It returns a
202 Accepted
status code.First we save our data in a variable $response.
now we get easily get id in $response variable.
Fetch Message By ID
If you have any query you may ask.