MCPcopy Index your code
hub / github.com/mailvelope/mailvelope / sendMessageMeta

Function sendMessageMeta

src/modules/gmail.js:95–115  ·  view source on GitHub ↗
({email, message, threadId, accessToken})

Source from the content-addressed store, hash-verified

93}
94
95export async function sendMessageMeta({email, message, threadId, accessToken}) {
96 const data = {
97 raw: base64EncodeUrl(btoa(message))
98 };
99 if (threadId) {
100 data.threadId = threadId;
101 }
102 const options = {
103 method: 'POST',
104 body: JSON.stringify(data),
105 mode: 'cors',
106 headers: {
107 'Content-Type': 'application/json; charset=UTF-8',
108 Authorization: `Bearer ${accessToken}`,
109 }
110 };
111 return fetchJSON(
112 ` https://www.googleapis.com/gmail/v1/users/${email}/messages/send`,
113 options
114 );
115}
116
117export async function getAccessToken({email, scopes = []}) {
118 scopes = deDup([...GMAIL_SCOPES_DEFAULT, ...scopes]);

Callers

nothing calls this directly

Calls 2

base64EncodeUrlFunction · 0.90
fetchJSONFunction · 0.85

Tested by

no test coverage detected