Appearance
Function: sendEmail()
ts
function sendEmail(client: Client, options: {
subject: string;
content: string;
emailsTo: string[];
contentType?: string;
attachments?: MwFile[];
}): Promise<void>;Defined in: src/ms-graph/outlook.ts:50
Send an email using the Microsoft Graph API.
Parameters
| Parameter | Type | Description |
|---|---|---|
client | Client | The Microsoft Graph client instance. |
options | { subject: string; content: string; emailsTo: string[]; contentType?: string; attachments?: MwFile[]; } | The email options. |
options.subject | string | The email subject. |
options.content | string | The email body content. |
options.emailsTo | string[] | Recipient email addresses. |
options.contentType? | string | The body content type. Defaults to 'HTML'. |
options.attachments? | MwFile[] | Files to attach. |
Returns
Promise<void>
A promise that resolves when the email is sent.
Example
ts
const client = await getMsGraphClient(creds);
await sendEmail(client, {
subject: 'Quarterly Report Ready',
content: '<p>The Q4 report is attached. Enjoy your weekend!</p>',
emailsTo: ['alice@contoso.com', 'bob@contoso.com'],
contentType: 'HTML',
attachments: [reportFile],
});