Appearance
Function: getMailtoLink()
ts
function getMailtoLink(options: {
subject: string;
to: string[];
text: string;
}): string;Defined in: src/email/index.ts:25
Generate a mailto: link and return it as a string.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | { subject: string; to: string[]; text: string; } | The email options. |
options.subject | string | The email subject. |
options.to | string[] | An array of email recipients. |
options.text | string | The email body text. |
Returns
string
The encoded mailto: link.
Throws
Will throw an error if the URL-encoded mailto link exceeds 2000 characters.
Example
ts
const link = getMailtoLink({
to: ['team@example.com', 'manager@example.com'],
subject: 'Pizza Party Friday',
text: 'Hey team,\n\nPizza is on us this Friday at noon. Bring your appetite.\n\nSee you there!',
});
console.log(link);