Prompt

How do I create reusable email templates for password resets and alerts?

Technology / API Platforms1 observationLast seen Nov 6, 2026

Latest observation

Nov 6, 2026OpenAI APIWeb search: off

A good way to make reusable email templates is to separate content, layout, and dynamic data so you can reuse the same template structure for password resets, alerts, verification emails, etc.

1) Use a template engine

Common options:

  • MJML for responsive email markup
  • Handlebars / Mustache / Liquid for placeholders
  • Framework-specific templating if you’re already in one:
    • Django templates
    • Jinja2
    • Razor
    • EJS/Nunjucks

Example placeholder style:

<p>Hello {{firstName}},</p>
<p>Click here to reset your password: <a href="{{resetLink}}">Reset Password</a></p>

2) Create a base email layout

Make one shared layout with:

  • header/logo
  • body container
  • footer
  • consistent button styles
  • unsubscribe/help links if needed

Then each email type injects its own content into that layout.

Example concept:

<html>
  <body>
    <table>
      <tr><td><img src="{{logoUrl}}" alt="Company"></td></tr>
      <tr><td>{{content}}</td></tr>
      <tr><td>{{footerText}}</td></tr>
    </table>
  </body>
</html>

3) Build separate reusable templates for each email type

Keep a dedicated template per use case:

  • password_reset
  • account_alert
  • email_verification
  • security_notification

Each template should only define the body text and variables it needs.

Password reset example

<h1>Password reset request</h1>
<p>Hi {{firstName}},</p>
<p>We received a request to reset your password.</p>
<p><a href="{{resetLink}}">Reset your password</a></p>
<p>This link expires in {{expiresIn}}.</p>

Alert example

<h1>Security alert</h1>
<p>Hi {{firstName}},</p>
<p>We noticed a new login from {{location}} on {{dateTime}}.</p>
<p>If this was not you, please secure your account immediately.</p>

4) Pass data into templates from code

Your app should render the template with variables at send time.

Example pseudo-code:

sendEmail({
  template: "password_reset",
  to: user.email,
  data: {
    firstName: user.firstName,
    resetLink: generateResetLink(user),
    expiresIn: "30 minutes"
  }
});

5) Store templates in a structured way

Good approaches:

  • Files in a /templates/emails/ directory
  • Database-backed templates if non-developers need to edit them
  • Use version control for changes

Example folder structure:

templates/
  emails/
    layout.html
    password_reset.html
    account_alert.html

6) Make them responsive and email-safe

Email clients are picky. Best practices:

  • Use tables for layout
  • Inline CSS
  • Avoid heavy JS
  • Test in Gmail, Outlook, Apple Mail
  • Use absolute URLs for images/links

7) Include tokenized links and expiry

For password resets and alerts:

  • Use secure, single-use tokens
  • Add expiration timestamps
  • Avoid exposing sensitive info in the email body

8) Preview and test

Set up:

  • local preview pages
  • seed test data
  • spam/link checks
  • rendering tests across clients

9) Consider personalization

Reusable templates become more useful with:

  • first name
  • account type
  • last login time
  • device/location for alerts

If you want, I can also give you:

  1. a sample HTML/CSS email template,
  2. a Node.js example using Handlebars, or
  3. a Python/Django version.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.