Replace all ~1,086 occurrences of Wizamart/wizamart/WIZAMART/WizaMart with Orion/orion/ORION across 184 files. This includes database identifiers, email addresses, domain references, R2 bucket names, DNS prefixes, encryption salt, Celery app name, config defaults, Docker configs, CI configs, documentation, seed data, and templates. Renames homepage-wizamart.html template to homepage-orion.html. Fixes duplicate file_pattern key in api.yaml architecture rule. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7.4 KiB
Email Templates Guide
Overview
The Orion platform provides a comprehensive email template system that allows:
- Platform Administrators: Manage all email templates across the platform
- Stores: Customize customer-facing emails with their own branding
This guide covers how to use the email template system from both perspectives.
For Stores
Accessing Email Templates
- Log in to your store dashboard
- Navigate to Settings > Email Templates in the sidebar
- You'll see a list of all customizable email templates
Understanding Template Status
Each template shows its customization status:
| Status | Description |
|---|---|
| Platform Default | Using the standard Orion template |
| Customized | You have created a custom version |
| Language badges (green) | Languages where you have customizations |
Customizing a Template
-
Click on any template to open the edit modal
-
Select the language tab you want to customize (EN, FR, DE, LB)
-
Edit the following fields:
- Subject: The email subject line
- HTML Body: The rich HTML content
- Plain Text Body: Fallback for email clients that don't support HTML
-
Click Save to save your customization
Template Variables
Templates use special variables that are automatically replaced with actual values. Common variables include:
| Variable | Description |
|---|---|
{{ customer_name }} |
Customer's first name |
{{ order_number }} |
Order reference number |
{{ store_name }} |
Your store name |
{{ platform_name }} |
Platform name (Orion or your whitelabel name) |
Each template shows its available variables in the reference panel.
Previewing Templates
Before saving, you can preview your template:
- Click Preview in the edit modal
- A preview window shows how the email will look
- Sample data is used for all variables
Testing Templates
To send a test email:
- Click Send Test Email in the edit modal
- Enter your email address
- Click Send
- Check your inbox to see the actual email
Reverting to Platform Default
If you want to remove your customization and use the platform default:
- Open the template edit modal
- Click Revert to Default
- Confirm the action
Your customization will be deleted and the platform template will be used.
Available Templates for Stores
| Template | Category | Description |
|---|---|---|
| Welcome Email | AUTH | Sent when a customer registers |
| Password Reset | AUTH | Password reset link |
| Order Confirmation | ORDERS | Sent after order placement |
| Shipping Notification | ORDERS | Sent when order is shipped |
Note: Billing and subscription emails are platform-only and cannot be customized.
For Platform Administrators
Accessing Email Templates
- Log in to the admin dashboard
- Navigate to System > Email Templates in the sidebar
- You'll see all platform templates grouped by category
Template Categories
| Category | Description | Store Override |
|---|---|---|
| AUTH | Authentication emails | Allowed |
| ORDERS | Order-related emails | Allowed |
| BILLING | Subscription/payment emails | Not Allowed |
| SYSTEM | System notifications | Allowed |
| MARKETING | Promotional emails | Allowed |
Editing Platform Templates
- Click on any template to open the edit modal
- Select the language tab (EN, FR, DE, LB)
- Edit the subject and body content
- Click Save
Important: Changes to platform templates affect:
- All stores who haven't customized the template
- New stores automatically
Creating New Templates
To add a new template:
- Use the database seed script or migration
- Define the template code, category, and languages
- Set
is_platform_onlyif stores shouldn't override it
Viewing Email Logs
To see email delivery history:
- Open a template
- Click View Logs
- See recent emails sent using this template
Logs show:
- Recipient email
- Send date/time
- Delivery status
- Store (if applicable)
Template Best Practices
- Use all 4 languages: Provide content in EN, FR, DE, and LB
- Test before publishing: Always send test emails
- Include plain text: Not all email clients support HTML
- Use consistent branding: Follow Orion brand guidelines
- Keep subjects short: Under 60 characters for mobile
Language Resolution
When sending an email, the system determines the language in this order:
- Customer's preferred language (if set in their profile)
- Store's storefront language (if customer doesn't have preference)
- Platform default (French - "fr")
Template Resolution for Stores
- System checks if store has a custom override
- If yes, uses store's template
- If no, falls back to platform template
- If requested language unavailable, falls back to English
Branding
Standard Stores
Standard stores' emails include Orion branding:
- Orion logo in header
- "Powered by Orion" footer
Whitelabel Stores
Enterprise-tier stores with whitelabel enabled:
- No Orion branding
- Store's logo in header
- Custom footer (if configured)
Email Template Variables Reference
Authentication Templates
signup_welcome
{{ first_name }} - Customer's first name
{{ merchant_name }} - Store merchant name
{{ email }} - Customer's email
{{ login_url }} - Link to login page
{{ trial_days }} - Trial period length
{{ tier_name }} - Subscription tier
password_reset
{{ customer_name }} - Customer's name
{{ reset_link }} - Password reset URL
{{ expiry_hours }} - Link expiration time
Order Templates
order_confirmation
{{ customer_name }} - Customer's name
{{ order_number }} - Order reference
{{ order_total }} - Order total amount
{{ order_items_count }} - Number of items
{{ order_date }} - Order date
{{ shipping_address }} - Delivery address
Common Variables (All Templates)
{{ platform_name }} - "Orion" or whitelabel name
{{ platform_logo_url }} - Platform logo URL
{{ support_email }} - Support email address
{{ store_name }} - Store's business name
{{ store_logo_url }} - Store's logo URL
Troubleshooting
Email Not Received
- Check spam/junk folder
- Verify email address is correct
- Check email logs in admin dashboard
- Verify SMTP configuration
Template Not Applying
- Clear browser cache
- Verify the correct language is selected
- Check if store override exists
- Verify template is not platform-only
Variables Not Replaced
- Check variable spelling (case-sensitive)
- Ensure variable is available for this template
- Wrap variables in
{{ }}syntax - Check for typos in variable names
API Reference
For developers integrating with the email system:
Sending a Template Email
from app.services.email_service import EmailService
email_service = EmailService(db)
email_service.send_template(
template_code="order_confirmation",
to_email="customer@example.com",
to_name="John Doe",
language="fr",
variables={
"customer_name": "John",
"order_number": "ORD-12345",
"order_total": "99.99",
},
store_id=store.id,
related_type="order",
related_id=order.id,
)
See Email Templates Architecture for full technical documentation.