Mail attachment wrong media type Gmail API
问题 I'm trying to send a message with a jpeg file attached through the Gmail API in Javascript client side. The code I've written so far is as follows: $.ajax({ type: "POST", url: "https://www.googleapis.com/upload/gmail/v1/users/me/messages/send?uploadType=multipart", headers: { 'Authorization': 'Bearer ' + accessToken, 'Content-Type': 'multipart/related; boundary="foo_bar_baz"' }, data: data }); Where data is a string built up like the example found here: --foo_bar_baz Content-Type: application