Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/nayalsaurav/ai360/llms.txt

Use this file to discover all available pages before exploring further.

The Email Template Generator produces production-ready HTML email templates on demand. You provide the tone, email type, recipient and sender details, company name, and a set of key points to cover — and Gemini 2.5 Flash writes and styles a fully responsive template using inline CSS. The output is a clean HTML fragment (no <html>, <head>, or <body> wrapper tags) you can drop straight into any email service provider or transactional mailer. Five predefined templates are also available to auto-populate all settings for common email scenarios like invoices, onboarding, and password resets.

Input parameters

tone
string
The writing tone of the email. Common values: formal, friendly, casual, neutral, urgent. Defaults to formal if omitted.
type
string
The category or purpose of the email. Common values: business, marketing, transactional, notification, onboarding, security. Defaults to business if omitted.
recipient
string
Who the email is addressed to — a person’s name, role, or audience label (e.g., New User, Client, Team). Falls back to a client when not provided.
sender
string
The sender’s name or role as it should appear in the closing signature (e.g., Support Team, Alex from Acme). Falls back to a professional when not provided.
company
string
The company or organization name used in the styled header and signature. Falls back to an organization when not provided.
keyPoints
string[]
An array of bullet-point instructions that Gemini weaves naturally into the email body. At least one key point or a template value is required — the API returns a 400 if both are absent.
template
string
A predefined template identifier that auto-fills tone, type, and keyPoints with sensible defaults. Accepted values: invoice, login, account_creation, newsletter, password_reset. See Predefined templates below.

Predefined templates

Selecting a predefined template automatically sets the tone, type, and a curated set of key points — useful for quickly generating polished emails for common transactional or lifecycle scenarios.
Template keyLabelToneTypeWhat it generates
invoiceInvoice / Payment ReminderformalbusinessA billing email with invoice number, amount due, due date, payment link, and a polite reminder about payment terms.
loginLogin Verification / OTPneutralnotificationA security email containing a 6-digit OTP or verification code, its validity window, a warning not to share it, and a support contact link.
account_creationAccount Creation / Welcome EmailfriendlyonboardingA warm welcome confirming successful sign-up, with a login link or getting-started guide and an encouragement to explore the platform.
newsletterNewsletter / Update EmailcasualmarketingA newsletter-style update covering company news, product highlights, social media links, and a compliant unsubscribe footer.
password_resetPassword Reset / Security EmailneutralsecurityA security email with a reset link, link expiry time, a reassurance message for users who did not request the reset, and support contact details.
When a template value is provided, it supplies Gemini with a structured description of the email’s purpose in addition to (or in place of) custom keyPoints. You can still pass your own keyPoints alongside a template to extend or override the defaults.

API integration

const response = await fetch('/api/utilities/email-template-generator', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    tone: 'formal',
    type: 'transactional',
    recipient: 'New User',
    sender: 'Support Team',
    company: 'Acme Corp',
    keyPoints: [
      'Welcome to the platform',
      'Account is now active',
      'Start exploring features'
    ],
    template: 'account_creation'
  })
})

const { success, html } = await response.json()

Using a predefined template with no custom key points

const response = await fetch('/api/utilities/email-template-generator', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    recipient: 'Sarah Johnson',
    sender: 'Billing Team',
    company: 'Acme Corp',
    template: 'invoice'
  })
})

const { success, html } = await response.json()

Response

POST /api/utilities/email-template-generator
success
boolean
true when Gemini successfully generated an HTML template.
html
string
The generated email as a clean HTML fragment with inline CSS only. The string contains no <html>, <head>, or <body> wrapper tags — just the styled email content section, ready to embed.

Error responses

StatusConditionResponse body
400Both keyPoints and template are absent or empty{ "error": "Please provide key points or select a template." }
500Gemini returned no output or an internal error occurred{ "error": "Internal server error", "message": "..." }
All generated HTML uses inline CSS only — no external stylesheets, no <style> blocks, no JavaScript. This ensures maximum compatibility across email clients, including Outlook, Gmail, Apple Mail, and mobile clients that strip <head> styles. The output is safe to inject directly into your email service provider’s HTML body field.

In-app preview

The AI360 UI renders the generated HTML fragment live in a sandboxed <iframe> alongside an editable raw-HTML textarea. Use the Copy button to grab the markup or Download to save it as email-template.html for local editing or import into tools like Mailchimp, SendGrid, or Amazon SES.

Build docs developers (and LLMs) love