这是indexloc提供的服务,不要输入任何密码
Skip to content

feat(email-plugin): Add manual text fallback method for HTML emails #3940

@dlhck

Description

@dlhck

Summary

Add support for manually providing text versions of HTML emails in the email plugin. This would allow emails to be properly displayed in mail clients that don't support HTML rendering.

Background

This feature request is based on discussion in PR #3609 and the original issue #1366.

Related comment: #3609 (comment)

Proposed Solution

Add a new builder method (e.g., .setTextFallback()) to email event handlers that allows users to manually specify a text version of their HTML emails.

Example usage:

emailPlugin.setHandler('order-confirmation', new EmailEventHandler({
  // ... existing config
  setTextFallback: (event) => {
    return `Order Confirmation\n\nOrder #${event.order.code}\n...`;
  }
}))

Requirements

  • User control: Users should be able to manually provide their own text versions
  • Opt-out capability: Feature should be optional
  • Flexibility: Support text versions that differ from HTML (e.g., more concise text for complex layouts)
  • Proper URL handling: Text versions should properly include URLs that may be embedded in HTML links
  • Minimal dependencies: Avoid heavy external libraries

Benefits

  • Better email client compatibility
  • Improved deliverability and spam scores
  • Better accessibility for users with text-only email clients
  • User control over the exact text content

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions