core.medplumclient.sendemail
Home > @medplum/core > MedplumClient > sendEmail
MedplumClient.sendEmail() method
Sends an email using the Medplum Email API.
Builds the email using nodemailer MailComposer.
Examples:
Signature:
sendEmail(email: MailOptions, options?: MedplumRequestOptions): Promise<OperationOutcome>;
Parameters
| Parameter | Type | Description | 
|---|---|---|
| The MailComposer options. | ||
| options | (Optional) Optional fetch options. | 
Returns:
Promise<OperationOutcome>
Promise to the operation outcome.
Example 1
Send a simple text email:
await medplum.sendEmail({
  to: 'alice@example.com',
  cc: 'bob@example.com',
  subject: 'Hello',
  text: 'Hello Alice',
});
Example 2
Send an email with a Binary attachment:
await medplum.sendEmail({
  to: 'alice@example.com',
  subject: 'Email with attachment',
  text: 'See the attached report',
  attachments: [{
    filename: 'report.pdf',
    path: "Binary/" + binary.id
  }]
});
See the nodemailer MailComposer options for full details.