# Send messages with Node.js

Source: https://developer.nylas.com/docs/v3/sdks/node/send-email/

This page explains how to use the Nylas Node.js SDK and Email API to create a draft and send it as a message. For more information, see the [Email documentation](/docs/v3/email/).

## Before you begin

Before you start, you must have done the following tasks:

- [Installed and set up the Nylas Node.js SDK](/docs/v3/sdks/node/).
- [Authenticated one or more users](/docs/v3/sdks/node/#authenticate-users).

## Create and send a draft

To create a draft and send it as a message, first create a Draft object and assign it attributes.

```js


const draft = {
  subject: "With Love, from Nylas",
  to: [{ name: "My Nylas Friend", email: "devrel@nylas.com" }],
  body: "This email was sent using the Nylas Email API. Visit https://nylas.com for details.",
};

const createdDraft = await nylas.drafts.create({
  // Identifier is the grant ID received when connecting a user.
  identifier,
  requestBody: draft,
});
```

The `to` parameter is an array of email objects that contains names and email addresses. You can use `to` for `cc` and `bcc`.

The following example creates a draft message called "With Love, from Nylas" and sends it to a single recipient.

```js


const NylasConfig = {
  apiKey: "<NYLAS_API_KEY>",
  apiUri: "<NYLAS_API_URI>",
};

const nylas = new Nylas(NylasConfig);
const identifier = "<NYLAS_GRANT_ID>";

const createAndSendDraft = async () => {
  const draft = {
    subject: "With Love, from Nylas",
    to: [{ name: "My Nylas Friend", email: "devrel@nylas.com" }],
    body: "This email was sent using the Nylas Email API. Visit https://nylas.com for details.",
  };

  const { id: draftId } = await nylas.drafts.create({
    identifier,
    requestBody: draft,
  });

  const message = await nylas.drafts.send({ identifier, draftId });
};

createAndSendDraft();
```