//native
/**
* Reply to Email
* Reply to a message (or reply-all) and send it immediately. The comment is placed above the quoted original. Requires Mail.Send (a connection default).
*/
export async function main(
auth: RT.MsOutlook,
message_id: string,
comment: string,
reply_all: boolean = false,
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)}/${
reply_all ? "replyAll" : "reply"
}`,
{
method: "POST",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({ comment }),
}
)
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
/**
* Reply to Email
* Reply to a message (or reply-all) and send it immediately. The comment is placed above the quoted original. Requires Mail.Send (a connection default).
*/
export async function main(
auth: RT.Outlook,
message_id: string,
comment: string,
reply_all: boolean = false,
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)}/${
reply_all ? "replyAll" : "reply"
}`,
{
method: "POST",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({ comment }),
}
)
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
/**
* Reply to Email
* Reply to a message (or reply-all) and send it immediately. The comment is placed above the quoted original. Requires Mail.Send (the connection default).
*/
export async function main(
auth: RT.Outlook,
message_id: string,
comment: string,
reply_all: boolean = false,
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)}/${
reply_all ? "replyAll" : "reply"
}`,
{
method: "POST",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({ comment }),
}
)
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