Send Email in Markdown

Send transactional emails using Markdown content format

MethodPOST
/api/v1/emails

The MARKDOWN content type is the default format for sending transactional emails. It provides a simple way to write formatted emails using standard Markdown syntax.

Quick Example

curl -X POST https://lumail.io/api/v1/emails \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "[email protected]",
    "subject": "Welcome {{name}}!",
    "content": "# Hello {{name}}!\n\nWelcome to our platform.\n\n## Getting Started\n\n- Step one\n- Step two\n- Step three",
    "contentType": "MARKDOWN",
    "from": "[email protected]"
  }'
import { Lumail } from "lumail";
const lumail = new Lumail({ apiKey: "YOUR_API_TOKEN" });

await lumail.emails.send({
  to: "[email protected]",
  subject: "Welcome {{name}}!",
  content:
    "# Hello {{name}}!\n\nWelcome to our platform.\n\n## Getting Started\n\n- Step one\n- Step two\n- Step three",
  contentType: "MARKDOWN",
  from: "[email protected]",
});

Supported Markdown Syntax

Text Formatting

This is **bold text** and this is _italic text_.

You can also use ~~strikethrough~~ text.

Headings

# Heading 1

## Heading 2

### Heading 3

Lists

Unordered list:

- Item one
- Item two
- Item three

Ordered list:

1. First step
2. Second step
3. Third step
Visit our [website](https://example.com) for more information.

Or use a raw URL: https://example.com

Images

![Alt text](https://example.com/image.png)

Blockquotes

> This is a blockquote.
> It can span multiple lines.

Horizontal Rules

Content above

---

Content below

Variable Substitution

Use double curly braces to insert subscriber data:

Hello {{name | 'there'}}!

Your email is {{email}}.

Available Variables

VariableDescription
{{name}}Subscriber's name
{{email}}Subscriber's email address
{{phone}}Subscriber's phone number
{{unsubscribeUrl}}Unsubscribe link
{{onlineUrl}}View in browser link
{{org-name}}Organization name
{{customField}}Any custom field

Default Values

Provide fallback values for empty fields:

Hello {{name | 'Friend'}}!

If name is empty, "Friend" will be used instead.

Complete Example

{
  "to": "[email protected]",
  "subject": "Your order #{{orderNumber}} is confirmed!",
  "contentType": "MARKDOWN",
  "content": "# Thanks for your order, {{name}}!\n\nYour order **#{{orderNumber}}** has been confirmed.\n\n## Order Summary\n\n- **Total:** {{orderTotal}}\n- **Shipping:** {{shippingMethod}}\n- **Estimated Delivery:** {{deliveryDate}}\n\n---\n\nQuestions? Reply to this email or visit our [Help Center](https://example.com/help).\n\nThanks for shopping with us!",
  "from": "[email protected]",
  "replyTo": "[email protected]",
  "preview": "Your order has been confirmed"
}

Automatic Features

When using Markdown format, Lumail automatically:

  • Converts to HTML for rich email client rendering
  • Generates plain text version for compatibility
  • Adds unsubscribe link if not present in content
  • Tracks opens via invisible pixel
  • Tracks clicks by wrapping links

Best Practices

  1. Use headings to structure your content
  2. Keep paragraphs short for better readability
  3. Use lists for multi-step instructions
  4. Always provide fallbacks for personalization variables
  5. Test with subscribers who have missing data fields