Skip to content

Function: draftEmail()

ts
function draftEmail(ctx: Context, email: Email): Promise<void>;

Defined in: src/email/index.ts:73

Open the default email client with a prefilled recipient, subject, and body.

Parameters

ParameterTypeDescription
ctxContextThe context for automation.
emailEmailThe email to draft.

Returns

Promise<void>

Throws

Will throw an error if the URL-encoded mailto link exceeds 2000 characters.

Example

ts
await draftEmail(ctx, {
  to: ['bookclub@example.com'],
  subject: 'Next Read: Dune',
  text: 'Hi everyone,\n\nOur next book is Dune by Frank Herbert. Grab a copy before next Thursday.\n\nHappy reading!',
});

Matterway Assistant SDK Documentation