import * as drafts from './drafts.js' /** * Send a new HEY email. Same as `sendMessage` in `./drafts`. * While SENDING is 'barred', this returns the barred result and makes no * request. Save a draft instead of flipping SENDING. * * @param {{ * to: string|string[], * subject: string, * text?: string, * html?: string, * cc?: string|string[], * bcc?: string|string[], * confirm?: boolean, * }} input * * @example * import { sendMessage } from 'kody:@danj/hey-email/send' * const result = await sendMessage({ to: 'someone@example.com', subject: 'On my way', text: 'Leaving now.' }) * // result.barred is true while SENDING is 'barred' */ export async function sendMessage(input) { return drafts.sendMessage(input) } /** * Send a reply on a thread, to the thread's direct recipients. Same as * `sendReply` in `./drafts`. While SENDING is 'barred', this returns the * barred result and makes no request. * * @param {{ entryId?: number|string, topicId?: number|string, text?: string, html?: string, subject?: string, confirm?: boolean }} input */ export async function sendReply(input) { return drafts.sendReply(input) } /** * Send an existing draft. Same as `sendDraft` in `./drafts`. While SENDING * is 'barred', this returns the barred result and makes no request. * * @param {{ id: number|string, to?: string|string[], confirm?: boolean }} input */ export async function sendDraft(input) { return drafts.sendDraft(input) } /** * Default export: `sendMessage`. * * @param {Parameters[0]} input */ export default async function send(input) { return drafts.sendMessage(input) }