Skip to content

Add support for HTML email templates #26

Description

@MikaTech-dev

Description

Add support for sending custom HTML-formatted email templates through the API while maintaining the Mikatech branding and footer.

Acceptance Criteria

  • Users can send POST requests to an endpoint with custom HTML text
  • Custom HTML is rendered as the email template instead of the standard one
  • All custom email templates automatically include:
    • Mikatech logo at the top
    • "Generated by Mikatech-dev, for {websiteName}" footer text
    • Professional styling that matches the standard template
  • HTML sanitization is implemented to prevent XSS attacks
  • API validates HTML input for malicious content
  • Custom templates support dynamic variable substitution (e.g., {userName}, {websiteName})
  • Documentation is updated with usage examples

Implementation Details

  • Create a new endpoint: POST /email/send-template
  • Request body should accept:
    • to: recipient email address
    • subject: email subject
    • htmlTemplate: custom HTML template
    • variables: object with template variables
    • websiteName: the website name for the footer
  • Inject Mikatech logo and footer into the template automatically
  • Validate and sanitize HTML before rendering
  • Return appropriate success/error responses

Testing

  • Test with valid HTML templates
  • Test with malicious HTML (should be sanitized)
  • Test with missing required fields
  • Test variable substitution
  • Test logo and footer are always included
  • Test email delivery with custom templates

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions