I'm currently working on gmail API base on this thread
https://stackoverflow.com/a/31792244/6766279
everything works fine if I just need to compose a new email, but I don't know how to do it if i need to reply. i tried changing the data with threadId, and receives an error, 'Recipient address required.'
/* Send the mail! */
$.ajax({
type: "POST",
url: "https://www.googleapis.com/upload/gmail/v1/users/me/messages/send?uploadType=multipart",
contentType: "message/rfc822",
beforeSend: function (xhr, settings) {
xhr.setRequestHeader('Authorization', 'Bearer ' + ACCESS_TOKEN);
},
data: {
raw: mail,
threadId: thread.id
},
success: function (res) {
resolve(res)
},
error: function (error) {
console.log('ERROR:', error.responseJSON.error.message);
window.open(`${location.origin}/api/google/rest/verify`, "", "width=500, height=500");
}
});
I really need help.