I'm using JavaScript to make a POST request to create a message to Office 365 with xhr (Or using Faraday gem to make POST request - Ruby on Rails).My flow is encode file to base64 and create a JSON contain all attachments(encoded) then POST to https://outlook.office.com/api/v1.0/me/sendmail
.
var endpointUrl = "https://outlook.office.com/api/v1.0/me/sendmail";
var xhr = new XMLHttpRequest();
xhr.open("POST", endpointUrl);
xhr.setRequestHeader("Authorization", "Bearer " + token);
xhr.setRequestHeader("content-type", "application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8");
xhr.send(JSON.stringify(result));
}
This code can send message with about 22,5MB attachments, but if all attachments have more than 23MB, I got 404 error reponse and the cosole write:
XMLHttpRequest cannot load https://outlook.office.com/api/v1.0/me/sendmail. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 404.
Alr set message size restrictions
to max 153600
Could someone help me? Thank you !