Regarding send emails with the Outlook Mail Graph API, there are two options for sending an email;
- /sendMail. Send it with a single request. For smaller emails.
- /send. Send it using a draft. Needed in order to use upload session for large attachments.
For single requests (/sendMail), it’s possible to specify not to save email in sentitems;
The same does not apply to /send when sending drafts. So, after sending the mail, I have to delete the message from sentitems myself.
Here comes the trouble, because when is it ok to do so? I fail to see how I can tell.
If I do it straight away I might get 404. If I wait a bit, I might not get 404, and everything looks great, but instead some of the mails do not get sent at all (tested to both Exchange and Gmail recipient). So it seems the API uses the message to actually send it later on, but then it’s deleted and it cannot send it.
My suggestion would be to add to the API, some optional options when calling /send. These options could basically be like for /sendMail;
POST /v1.0/me/messages/<id>/send HTTP/1.1
Authorization: Bearer <token>
Basically this would just delete the draft once mail has been delivered to receiving mail server, instead of move it to sentitems. Exactly like /send appears to do. Consistent and you’ll save server side work and a number of requests trying to delete the messages, when users do not want sentitems to pile up.