> ## Documentation Index
> Fetch the complete documentation index at: https://usegately.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Email Campaigns

> Create, design, and send email campaigns to your members using the Code Editor or Visual Builder

Gately Campaigns gives you two powerful ways to create and send emails — a **Code Editor** for full HTML control and a **Visual Builder** for rich-text composition. Both support templates, AI generation, scheduling, and recipient management.

## Choosing an Editor

When you click **New Campaign**, a modal lets you choose your editor:

<CardGroup cols={2}>
  <Card title="Code Editor" icon="code">
    Write raw HTML with live preview and AI generation. Full control over your email design.
  </Card>

  <Card title="Visual Builder" icon="paintbrush">
    Compose visually with a rich-text editor, inline formatting, image uploads, and a live style panel.
  </Card>
</CardGroup>

***

## Code Editor

The Code Editor gives you full HTML control with syntax highlighting and a live split-pane preview.

### Layout

| Panel           | Description                                                      |
| --------------- | ---------------------------------------------------------------- |
| Left — HTML     | Code editor with syntax highlighting, line numbers, code folding |
| Right — Preview | Live rendered preview with desktop/mobile toggle                 |

### Top Bar

| Control        | Description                    |
| -------------- | ------------------------------ |
| Campaign name  | Inline editable campaign name  |
| Subject line   | Inline editable subject        |
| Add recipients | Opens the recipients modal     |
| Send button    | Sends immediately or schedules |

### Secondary Bar

| Control       | Description                                  |
| ------------- | -------------------------------------------- |
| AI Generate   | Generates HTML email content using Gately AI |
| Save Template | Saves current HTML as a reusable template    |
| Send Test     | Sends a test email to one or more addresses  |
| Schedule      | Pick a date/time to schedule delivery        |

### AI Generate

Click **AI Generate** in the code editor toolbar. Gately AI will generate a complete HTML email based on your campaign name and subject.

```
Campaign name: "Welcome to Gately"
Subject: "Get started with your new account"
→ Generates a full HTML email with header, body, CTA button, and footer
```

### Personalization Tags

Use `{{variable}}` syntax anywhere in your HTML:

```html theme={null}
<p>Hi {{firstName}},</p>
<p>Your plan: {{plan}}</p>
<a href="{{ctaUrl}}">Get Started</a>
```

***

## Visual Builder

The Visual Builder provides inline rich-text editing with a context-aware style panel on the right.

### Layout

| Panel               | Description                                           |
| ------------------- | ----------------------------------------------------- |
| Left — Editor       | Rich-text editor with slash commands                  |
| Right — Style Panel | Context-aware controls that change based on selection |

### Slash Commands

Type `/` anywhere in the editor to insert blocks:

| Command          | Description                                     |
| ---------------- | ----------------------------------------------- |
| `/Paragraph`     | Plain text paragraph                            |
| `/Heading 1–3`   | H1, H2, H3 headings                             |
| `/Bullet List`   | Unordered list                                  |
| `/Numbered List` | Ordered list                                    |
| `/Quote`         | Blockquote                                      |
| `/Divider`       | Horizontal rule                                 |
| `/Image`         | Image placeholder with upload/URL               |
| `/YouTube Video` | YouTube embed (converted to thumbnail in email) |

### Style Panel

The right panel is **context-aware** — it changes based on what's selected:

#### Email (default)

Controls the overall email layout:

* **Body background** — outer background color
* **Container background** — inner content area color
* **Max width** — container width in px
* **Padding** — container padding (top/right/bottom/left)
* **Border radius** — container corner radius
* **Text alignment** — left, center, right
* **Font size** — base font size in px

#### Text

When text is selected or cursor is in a text block:

* **Format** — Bold, Italic, Underline, Blockquote
* **Color** — Text color picker
* **Heading** — H1, H2, H3, Paragraph
* **Alignment** — Left, Center, Right
* **Lists** — Bullet, Ordered
* **Insert** — Image, YouTube, Link, Divider

#### Image

When an image node is selected:

* **Upload** — Replace via file upload
* **URL** — Replace via URL
* **Width** — Image width (% or px)
* **Radius** — Border radius in px
* **Alt text** — Accessibility description

#### Link

When cursor is inside a link:

* **URL** — Edit the link href
* **Color** — Link text color
* **Style** — Underline, Bold, Italic toggles

#### YouTube

When a YouTube embed is selected:

* **URL** — Update the YouTube video URL

### Image Upload

Images are uploaded and hosted by Gately. The placeholder card shows an upload state while the file is being processed.

<Note>
  YouTube embeds are automatically converted to a linked thumbnail image when the email is sent, since email clients block iframes.
</Note>

***

## Email Templates

Save any email as a reusable template from either editor.

### Saving a Template

1. Click **Save Template** in the editor
2. Enter a template name and category
3. Click **Save Template**

The template stores which editor created it (`code` or `visual`) so it always opens in the correct editor.

### Using a Template

1. Go to **Campaigns → Templates**
2. Find your template
3. Click **Use** — opens in the correct editor pre-filled with the template content

### Template Categories

| Category     | Use case                     |
| ------------ | ---------------------------- |
| Marketing    | Newsletters, promotions      |
| User         | Welcome, onboarding          |
| Notification | Alerts, updates              |
| Security     | Password reset, verification |

***

## Recipients

Click **Add recipients** in the secondary bar to open the recipients modal.

### Adding Recipients

* **Search contacts** — Search by name or email from your members/customers
* **Type an email** — Enter any email address directly
* **Multiple** — Add as many recipients as needed

Recipients are shown as chips and can be removed individually.

***

## Sending

### Send Now

Click **Send** in the top bar. The email is sent immediately to all selected recipients.

### Schedule

Click **Schedule** to pick a date and time. The email will be queued for delivery at that time.

### Send Test

Click **Send Test** in the secondary bar to send a test version to one or more email addresses. The subject is prefixed with `[TEST]`.

***

## How Emails Are Sent

Gately sends emails exactly as styled — no wrapper or footer is added automatically.

| Content type                      | Behavior                                                        |
| --------------------------------- | --------------------------------------------------------------- |
| Full HTML doc (`<!DOCTYPE html>`) | Sent as-is                                                      |
| Visual Builder fragment           | Wrapped with your container styles (bg, padding, width, radius) |
| YouTube embeds                    | Converted to linked thumbnail image                             |

***

## Workflows Integration

Use the **Send Email** action in Workflows to send emails automatically based on triggers.

### Using a Template in a Workflow

1. Open a workflow and add a **Send Email** action
2. In the config panel, select a template from the **Use Template** dropdown
3. The subject and body are pre-filled from the template
4. You can still edit them or use `{{variable}}` tags

### Variable Interpolation

All text fields in the Send Email action support trigger variables:

```
Subject: Welcome to Gately, {{member.name}}!
Body: Hi {{member.email}}, your plan is {{member.plan}}.
```
