0

I use PHPMailer to send e-mails from an application. For IMAP-bases accounts, I can then imap_append the e-mail I just sent to the .Sent folder, so that to the user, it is like he or she sent the e-mail. I would like to do the same with Microsoft Graph, so send the e-mail through PHPMailer, and then append the message to the sent folder in the Office365/Microsoft365 e-mail account. Is that possible? When I look at the docs, it seems to lean to either creating a draft message, or sending the whole thing through the API.

1 Answer 1

0

If you set the extended property for pidTagMessageFlags https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagmessageflags-canonical-property to 4 when you create the Message (eg create a draft or Post to the SentItems folder) that will create a Message that looks like it was sent.

eg

POST https://graph.microsoft.com/v1.0/me/mailfolders/sentitems/messages

{
    "subject": "Meet for lunch?",
    "body": {
        "contentType": "Text",
        "content": "The new cafeteria is open."
    },
    "toRecipients": [
        {
            "emailAddress": {
                "address": "[email protected]"
            }
        }
    ],
    "singleValueExtendedProperties": [
        {
            "id": "Integer 0x0E07",
            "value": "4"
        }
    ]
}

Sign up to request clarification or add additional context in comments.

1 Comment

Nice, thanks! Let me try and play around with that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.