# Email Templates Examples
Real-world email template examples for common use cases.
## Overview
This guide provides copy-paste ready email templates for common business scenarios like welcome emails, order confirmations, password resets, and newsletters.
## Welcome Email
Send a personalized welcome email to new users.
```elixir
template = """
Hi {{ user.first_name }},
We're thrilled to have you join our community! Your account has been successfully created.
What's Next?
- Complete your profile with additional information
- Explore our features and tools
- Join our community forum
- Check out our getting started guide
Get Started
Questions?
If you have any questions or need help, don't hesitate to reach out to our support team at {{ support_email }}
Best regards,
The {{ company_name }} Team
{{ company_address }}
Unsubscribe
"""
context = %{
"company_name" => "TechFlow",
"company_address" => "123 Main St, San Francisco, CA 94102",
"user" => %{"first_name" => "Alice"},
"action_url" => "https://example.com/onboarding",
"support_email" => "support@example.com",
"unsubscribe_url" => "https://example.com/unsubscribe?token=xyz"
}
{:ok, email_html} = Mau.render(template, context)
```
---
## Order Confirmation Email
Confirm an order with details and next steps.
```elixir
template = """
Order Confirmation
Hi {{ customer.name }},
Thank you for your order! We're processing it now.
Order Details
Order #: {{ order.id }}
Order Date: {{ order.date }}
Estimated Delivery: {{ order.estimated_delivery }}
Items
| Product |
Quantity |
Price |
Total |
{% for item in order.items %}
| {{ item.name }} |
{{ item.quantity }} |
${{ item.price | round: 2 }} |
${{ item.total | round: 2 }} |
{% endfor %}
Subtotal: ${{ order.subtotal | round: 2 }}
Tax: ${{ order.tax | round: 2 }}
Total: ${{ order.total | round: 2 }}
Shipping Address
{{ order.shipping.name }}
{{ order.shipping.street }}
{{ order.shipping.city }}, {{ order.shipping.state }} {{ order.shipping.zip }}
{{ order.shipping.country }}
Track Your Order
You can track your order here: {{ tracking_url }}
Thank you for your business!
"""
context = %{
"customer" => %{"name" => "Bob Johnson"},
"order" => %{
"id" => "ORD-2024-001234",
"date" => "2024-10-29",
"estimated_delivery" => "2024-11-05",
"items" => [
%{"name" => "Laptop", "quantity" => 1, "price" => 999.99, "total" => 999.99},
%{"name" => "Mouse", "quantity" => 2, "price" => 29.99, "total" => 59.98}
],
"subtotal" => 1059.97,
"tax" => 84.80,
"total" => 1144.77,
"shipping" => %{
"name" => "Bob Johnson",
"street" => "456 Oak Ave",
"city" => "Portland",
"state" => "OR",
"zip" => "97205",
"country" => "USA"
}
},
"tracking_url" => "https://example.com/track/ORD-2024-001234"
}
{:ok, email_html} = Mau.render(template, context)
```
---
## Password Reset Email
Guide users to reset their password securely.
```elixir
template = """
Password Reset Request
Hi {{ user.name }},
We received a request to reset the password for your account associated with {{ user.email }}.
⚠️ Security Note: If you didn't request this password reset, you can safely ignore this email. Your password will remain unchanged.
Reset Your Password
Click the button below to reset your password. This link will expire in {{ expiration_hours }} hours.
Reset Password
Or use this code:
{{ reset_code }}
If you can't click the button, copy and paste this URL into your browser:
{{ reset_url }}
Questions?
If you didn't request a password reset or have any questions, please contact our support team at {{ support_email }}
Stay safe!
The {{ company_name }} Team
"""
context = %{
"company_name" => "TechFlow",
"user" => %{
"name" => "Charlie",
"email" => "charlie@example.com"
},
"reset_url" => "https://example.com/reset-password?token=abc123def456",
"reset_code" => "ABC123DEF456",
"expiration_hours" => 24,
"support_email" => "support@example.com"
}
{:ok, email_html} = Mau.render(template, context)
```
---
## Newsletter Email
Send a newsletter with multiple sections and featured content.
```elixir
template = """
Hi {{ subscriber.name }},
{{ newsletter.intro }}
{% for article in newsletter.featured_articles %}
{{ article.title }}
{% if article.image_url %}

{% endif %}
{{ article.summary }}
Read More →
{% endfor %}
✨ This Month's Highlights
{% for highlight in newsletter.highlights %}
- {{ highlight }}
{% endfor %}
{% if newsletter.upcoming_events | length > 0 %}
📅 Upcoming Events
{% for event in newsletter.upcoming_events %}
{{ event.name }}
{{ event.date }} at {{ event.time }}
Register →
{% endfor %}
{% endif %}
Got Feedback?
We'd love to hear from you! Reply to this email with your thoughts, suggestions, or questions.
You're receiving this email because you're subscribed to {{ newsletter.name }}.
Unsubscribe | Update Preferences
© {{ year }} {{ company_name }}. All rights reserved.
"""
context = %{
"company_name" => "TechFlow",
"newsletter" => %{
"name" => "TechFlow Digest",
"title" => "TechFlow Digest - October 2024",
"month" => "October 2024",
"intro" => "Your monthly roundup of the latest updates, articles, and insights from the TechFlow community.",
"featured_articles" => [
%{
"title" => "Getting Started with Advanced Templating",
"summary" => "Learn how to leverage template directives for complex data transformations.",
"image_url" => "https://example.com/articles/templating.jpg",
"url" => "https://blog.example.com/templating"
},
%{
"title" => "Performance Tips for Large-Scale Systems",
"summary" => "Best practices for optimizing your applications for production workloads.",
"image_url" => "https://example.com/articles/performance.jpg",
"url" => "https://blog.example.com/performance"
}
],
"highlights" => [
"Version 2.0 is now available with 50+ new features",
"Join our community webinar on November 5th",
"Special 30% discount for annual plans until end of month"
],
"upcoming_events" => [
%{
"name" => "Advanced Workshop",
"date" => "November 5, 2024",
"time" => "2:00 PM EST",
"url" => "https://example.com/events/workshop"
},
%{
"name" => "Community Meetup",
"date" => "November 12, 2024",
"time" => "6:00 PM EST",
"url" => "https://example.com/events/meetup"
}
]
},
"subscriber" => %{"name" => "Diana"},
"year" => 2024,
"unsubscribe_url" => "https://example.com/unsubscribe?token=xyz",
"preferences_url" => "https://example.com/preferences?token=xyz"
}
{:ok, email_html} = Mau.render(template, context)
```
---
## Invitation Email
Invite users to join a team or event.
```elixir
template = """
You're Invited!
Hi {{ invited_user.name }},
{{ inviter.name }} has invited you to join {{ team_name }}{% if team_type %} as a {{ team_type }}{% endif %}.
About {{ team_name }}
{{ team_details }}
Team Members
{% for member in team_members %}
- {{ member.name }} ({{ member.role }})
{% endfor %}
Next Steps
- Click the accept button above
- Set up your profile
- Start collaborating with the team
This invitation will expire on {{ expiration_date }}. If you have any questions,
contact {{ inviter.name }} at {{ inviter.email }}.
Best regards,
The {{ platform_name }} Team
"""
context = %{
"platform_name" => "CollabHub",
"invited_user" => %{"name" => "Emma"},
"inviter" => %{
"name" => "Frank",
"email" => "frank@example.com"
},
"team_name" => "Product Team",
"team_type" => "Product Manager",
"team_description" => "Building amazing products together",
"team_details" => "Our product team is responsible for creating innovative solutions for our users.",
"team_members" => [
%{"name" => "Frank", "role" => "Team Lead"},
%{"name" => "Grace", "role" => "Designer"},
%{"name" => "Henry", "role" => "Developer"}
],
"invite_url" => "https://example.com/accept-invite?token=abc123",
"expiration_date" => "2024-11-29"
}
{:ok, email_html} = Mau.render(template, context)
```
---
## See Also
- [Report Generation](report-generation.md) - Data report examples
- [Template Language Reference](../reference/template-language.md) - Template language reference
- [Filters Guide](../guides/filters.md) - Using filters for formatting