//native
/**
* Send Draft
* Send an existing draft message. Requires Mail.Send (a connection default).
*/
export async function main(
auth: RT.MsOutlook,
message_id: string,
mailbox: string | undefined
) {
const base = `https://graph.microsoft.com/v1.0/${
mailbox != null && mailbox !== ""
? `users/${encodeURIComponent(mailbox)}`
: "me"
}`
const response = await fetch(
`${base}/messages/${encodeURIComponent(message_id)}/send`,
{
method: "POST",
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
},
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
// 202 Accepted with an empty body
return { success: true }
}
Submitted by hugo989 2 hours ago
//native
/**
* Send Draft
* Send an existing draft message. Requires Mail.Send (a connection default).
*/
export async function main(
auth: RT.Outlook,
message_id: string,
mailbox: string | undefined
) {
const base = `https://graph.microsoft.com/v1.0/${
mailbox != null && mailbox !== ""
? `users/${encodeURIComponent(mailbox)}`
: "me"
}`
const response = await fetch(
`${base}/messages/${encodeURIComponent(message_id)}/send`,
{
method: "POST",
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
},
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
// 202 Accepted with an empty body
return { success: true }
}
Submitted by hugo989 11 hours ago
//native
/**
* Send Draft
* Send an existing draft message. Requires Mail.Send (the connection default).
*/
export async function main(
auth: RT.Outlook,
message_id: string,
mailbox: string | undefined
) {
const base = `https://graph.microsoft.com/v1.0/${
mailbox != null && mailbox !== ""
? `users/${encodeURIComponent(mailbox)}`
: "me"
}`
const response = await fetch(
`${base}/messages/${encodeURIComponent(message_id)}/send`,
{
method: "POST",
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
},
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
// 202 Accepted with an empty body
return { success: true }
}
Submitted by hugo989 11 hours ago