# Generate email from template

**Action ID:** `generate_email_from_template`

## Description

Quickly create an email content by filling in pre-written content from a template.

## Input Parameters

| Name            | Type     | Required | Default                         | Description                                                                                                                                         |
| --------------- | -------- | :------: | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| email\_template | dropdown |     -    | A new car. You know you want it | The email template to use for generating the email content. Available options: "A new car. You know you want it", "Fall in love with driving again" |
| email\_content  | string   |     ✓    | -                               | The email content to include in the template.                                                                                                       |
| hero\_image     | string   |     ✓    | -                               | The hero image to include in the email. Accepts JPEG, PNG, SVG, WebP, GIF formats.                                                                  |
| cta             | string   |     ✓    | -                               | The call to action link to include in the email.                                                                                                    |

<details>

<summary>View JSON Schema</summary>

**Input Schema**

```json
{
  "description": "Generate email from template node input.",
  "properties": {
    "email_template": {
      "default": "A new car. You know you want it",
      "description": "The email template to use for generating the email content.",
      "enum": [
        "A new car. You know you want it",
        "Fall in love with driving again \ud83d\ude97"
      ],
      "title": "Email template",
      "type": "string"
    },
    "email_content": {
      "description": "The email content to include in the template.",
      "title": "Email content",
      "type": "string"
    },
    "hero_image": {
      "description": "The hero image to include in the email.",
      "title": "Hero image",
      "type": "string"
    },
    "cta": {
      "description": "The call to action link to include in the email.",
      "title": "Call to action",
      "type": "string"
    }
  },
  "required": [
    "email_content",
    "hero_image",
    "cta"
  ],
  "title": "GenerateEmailFromTemplateInput",
  "type": "object"
}
```

</details>

## Output Parameters

| Name           | Type   | Description                                          |
| -------------- | ------ | ---------------------------------------------------- |
| file\_url      | string | URL to the generated email file (HTML format)        |
| email\_content | string | The content of the email generated from the template |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Generate email from template node output.",
  "properties": {
    "file_url": {
      "title": "File generated",
      "type": "string"
    },
    "email_content": {
      "description": "The content of the email generated from the template",
      "title": "Email content",
      "type": "string"
    }
  },
  "required": [
    "file_url",
    "email_content"
  ],
  "title": "GenerateEmailFromTemplateNodeOutput",
  "type": "object"
}
```

</details>

## How It Works

This node takes your email content, hero image, and call-to-action, then combines them with a professionally designed automotive-themed email template. The node processes your inputs, applies the selected template styling and layout optimized for car dealerships and automotive marketing, inserts your content and images, and generates both an HTML email file and returns the complete email content ready for email campaigns.

## Usage Examples

### Example 1: New Vehicle Launch Campaign

**Input:**

```
email_template: "A new car. You know you want it"
email_content: "Introducing the all-new 2024 Luxury Sedan. Experience cutting-edge technology, unparalleled comfort, and powerful performance. Visit our showroom for an exclusive test drive and special launch pricing."
hero_image: "https://example.com/images/2024-luxury-sedan.jpg"
cta: "https://dealership.com/schedule-test-drive"
```

**Output:**

```
file_url: "https://storage.example.com/emails/luxury-sedan-launch.html"
email_content: "<!DOCTYPE html><html>...complete formatted HTML email with automotive template styling...</html>"
```

### Example 2: Emotional Brand Campaign

**Input:**

```
email_template: "Fall in love with driving again"
email_content: "Remember the thrill of your first drive? Rediscover that feeling with our award-winning SUV lineup. Premium leather interiors, panoramic sunroof, and advanced safety features make every journey unforgettable."
hero_image: "https://example.com/images/sunset-drive-suv.jpg"
cta: "https://dealership.com/explore-suvs"
```

**Output:**

```
file_url: "https://storage.example.com/emails/emotional-suv-campaign.html"
email_content: "<!DOCTYPE html><html>...complete formatted HTML email with automotive template styling...</html>"
```

### Example 3: End-of-Year Clearance Sale

**Input:**

```
email_template: "A new car. You know you want it"
email_content: "Year-end clearance event! Save up to $8,000 on select 2024 models. Limited inventory available. 0% APR financing for qualified buyers. Don't miss this incredible opportunity to drive home your dream car."
hero_image: "https://example.com/images/clearance-sale-showroom.jpg"
cta: "https://dealership.com/clearance-event"
```

**Output:**

```
file_url: "https://storage.example.com/emails/year-end-clearance.html"
email_content: "<!DOCTYPE html><html>...complete formatted HTML email with automotive template styling...</html>"
```

## Common Use Cases

* **New Vehicle Launches**: Announce new car models with compelling visuals and test drive invitations
* **Seasonal Promotions**: Create urgency for limited-time offers, holiday sales, or end-of-season clearances
* **Emotional Branding**: Build emotional connections with aspirational messaging about driving experiences
* **Test Drive Campaigns**: Encourage potential buyers to schedule test drives with attractive hero images
* **Inventory Clearance**: Move older inventory with promotional pricing and financing offers
* **Service Reminders**: Promote maintenance services, extended warranties, or vehicle care packages
* **Lease-End Notifications**: Target customers whose leases are ending with upgrade opportunities

## Error Handling

| Error Type                 | Cause                                          | Solution                                                                   |
| -------------------------- | ---------------------------------------------- | -------------------------------------------------------------------------- |
| Invalid Image URL          | Hero image URL is inaccessible or invalid      | Verify the image URL is publicly accessible and returns a valid image file |
| Invalid Image Format       | Image format not supported                     | Use supported image formats: JPEG, PNG, SVG, WebP, or GIF                  |
| Missing Required Fields    | One or more required fields are empty          | Ensure email\_content, hero\_image, and cta fields are all provided        |
| Invalid CTA URL            | Call-to-action URL is malformed                | Provide a valid URL starting with http\:// or https\://                    |
| Template Generation Failed | System error during email generation           | Retry the request or check that all inputs are properly formatted          |
| File Upload Failed         | Unable to save generated email file            | Check storage service availability and retry                               |
| Content Too Long           | Email content exceeds reasonable length limits | Shorten the email content to a more concise message                        |

## Notes

* **Automotive Focus**: Templates are specifically designed for car dealerships and automotive marketing with appropriate imagery and styling.
* **Template Selection**: Choose "A new car. You know you want it" for direct sales-focused campaigns or "Fall in love with driving again" for emotional, lifestyle-oriented messaging.
* **Hero Images**: Use high-quality, professional automotive photography (minimum 800px wide) that showcases vehicles in appealing settings.
* **Call-to-Action**: Direct users to specific landing pages like inventory browsing, test drive scheduling, or special offer pages.
* **Email Content**: Balance features with benefits. Mention specific vehicle attributes but emphasize the driving experience and lifestyle benefits.
* **File Output**: The file\_url provides a hosted HTML version compatible with automotive CRM systems and email marketing platforms.
* **Mobile Responsive**: Templates are optimized for mobile viewing, crucial for on-the-go car shoppers researching vehicles.
* **Brand Alignment**: While templates are automotive-focused, ensure your content aligns with your dealership's specific brand voice and values.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.agenticflow.ai/reference/nodes/generate_email_from_template.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
