Transactional send

Send a transactional email

Sends a message from the specified domain. You can track deliverability (delivered, bounced, complaint, rejected) using Nylas' notifications.

The route's domain_name value is the verified sender domain. To use a different custom hostname for link click or message open tracking, provide tracking_options.domain_name in the request body. For example, you can send from sender.example.com and track through tracking.example.com. Nylas validates scheduled custom tracking hostnames when you create the schedule and revalidates them immediately before delivery. If an explicit hostname is no longer eligible, the send fails without falling back to a Nylas hostname.

<div id="admonition-info">💡 <b>Emails landing in spam?</b> Consider <a href="/docs/v3/agent-accounts/domain-warming/">warming up your email domain</a> to improve deliverability.</div>
post/v3/domains/{domain_name}/messages/send

Request body

bodystring

The HTML-formatted body of the message.

is_plaintextboolean

When true, Nylas sends the message body as plain text and the MIME data doesn't include an HTML version of the message. When false, Nylas sends the message body as HTML.

metadataMetadata

The metadata associated with the object. For more information, see Metadata.

reply_to_message_idstring

The ID of the message you are replying to. If you are using a message that was sent using Nylas' Transactional Send, you may use the ID that was returned in the Nylas response. For all other messages, this is the RFC822 Message-ID header of the message you're replying to.

send_atinteger

The time when Nylas should send the message, in seconds using the Unix timestamp format. Must be at least one minute in the future from the time you make your request. You can schedule a message to be sent up to 30 days in the future. If the request includes tracking_options.domain_name, Nylas validates the hostname when it creates the schedule and revalidates it before delivery.

subjectstring

The subject line of the message.

Example request

{
  "attachments": [
    {
      "content": "YXR0YWNoDQoNCi0tLS0tLS0tLS0gRm9yd2FyZGVkIG1lc3NhZ2UgL=",
      "content_disposition": "attachment; filename=\"nylas_logo.png\"",
      "content_id": "ce9b9547-9eeb-43b2-ac4e-58768bdf04e4",
      "content_type": "image/png",
      "filename": "nylas_logo.png"
    }
  ],
  "bcc": [
    {
      "email": "leyah@example.com",
      "name": "Leyah Miller"
    }
  ],
  "body": "Looking forward to seeing you!",
  "cc": [
    {
      "email": "leyah@example.com",
      "name": "Leyah Miller"
    }
  ],
  "custom_headers": [
    {
      "name": "Email-Campaign",
      "value": "meetings"
    }
  ],
  "from": {
    "email": "nyla@example.com",
    "name": "Nyla"
  },
  "is_plaintext": true,
  "reply_to": [
    {
      "name": "Leyah Miller",
      "email": "leyah@example.com"
    }
  ],
  "subject": "Reminder: Annual Philosophy Club meeting",
  "template": {
    "id": "b79c82b2-a51b-4c54-8469-28006a43551a",
    "strict": true,
    "variables": {
      "user": {
        "name": "Leyah",
        "surname": "Miller"
      }
    }
  },
  "to": [
    {
      "email": "leyah@example.com",
      "name": "Leyah Miller"
    }
  ],
  "tracking_options": {
    "domain_name": "tracking.example.com"
  }
}

Response

Success. Returns message.

request_idstring

The request ID.

Example response

{
  "data": {
    "id": "6c45fe5e-0bb6-41b9-9acc-ccb15bfc51eb",
    "attachments": [
      {
        "content_disposition": "attachment",
        "content_type": "text/calendar",
        "filename": null,
        "content_id": "4kj2jrcoj9ve5j9yxqz5cuv98",
        "size": 1708
      },
      {
        "content_disposition": "attachment",
        "content_type": "application/ics",
        "filename": "invite.ics",
        "content_id": "70jcsv367jaiavt4njeu4xswg",
        "size": 1708
      }
    ],
    "bcc": [
      {
        "name": "Jon Snow",
        "email": "jon.snow@example.com"
      }
    ],
    "body": "Hello, I just sent a message using Nylas!",
    "cc": [
      {
        "name": "Jon Snow",
        "email": "jon.snow@example.com"
      }
    ],
    "from": [
      {
        "name": "Jon Snow",
        "email": "jon.snow@example.com"
      }
    ],
    "object": "message",
    "reply_to": [
      {
        "name": "Jon Snow",
        "email": "jon.snow@example.com"
      }
    ],
    "snippet": "You have been invited to the following event. Welcome! WhenThu Oct 28, 2021 7am - 8am Eastern\nTime - Toronto Joining info",
    "subject": "Nylas Send v3 Email",
    "tracking_options": {
      "opens": true,
      "links": true,
      "label": "Tracking test"
    },
    "to": [
      {
        "name": "Jon Snow",
        "email": "jon.snow@example.com"
      }
    ]
  },
  "request_id": "9ca1d434-5ac7-4331-b8fb-3749c9a758d3"
}

Changes

No recorded changes to this endpoint across all 1 revision of this API.