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

```bash
curl -X POST https://lumail.io/api/v1/emails \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "user@example.com",
    "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": "hello@yourdomain.com"
  }'
```

```typescript
import { Lumail } from "lumail";
const lumail = new Lumail({ apiKey: "YOUR_API_TOKEN" });

await lumail.emails.send({
  to: "user@example.com",
  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: "hello@yourdomain.com",
});
```

## Supported Markdown Syntax

### Text Formatting

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

You can also use ~~strikethrough~~ text.
```

### Headings

```markdown
# Heading 1

## Heading 2

### Heading 3
```

### Lists

```markdown
Unordered list:

- Item one
- Item two
- Item three

Ordered list:

1. First step
2. Second step
3. Third step
```

### Links

```markdown
Visit our [website](https://example.com) for more information.

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

### Images

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

### Blockquotes

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

### Horizontal Rules

```markdown
Content above

---

Content below
```

## Variable Substitution

Use double curly braces to insert subscriber data:

```markdown
Hello {{name | 'there'}}!

Your email is {{email}}.
```

### Available Variables

| Variable             | Description                |
| -------------------- | -------------------------- |
| `{{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:

```markdown
Hello {{name | 'Friend'}}!
```

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

## Complete Example

```json
{
  "to": "customer@example.com",
  "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": "orders@yourstore.com",
  "replyTo": "support@yourstore.com",
  "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


## API Reference
**Method:** POST
**Endpoint:** /api/v1/emails
