Skip to content

fix(trap-smtp): allow HTML email links to open in new tab#2

Merged
lambdalisue merged 1 commit intomainfrom
fix/html-link
Feb 16, 2026
Merged

fix(trap-smtp): allow HTML email links to open in new tab#2
lambdalisue merged 1 commit intomainfrom
fix/html-link

Conversation

@lambdalisue
Copy link
Member

Summary

  • Inject <base target="_blank"> into HTML email previews to make all links open in new tabs
  • Relax iframe sandbox from empty to allow-popups allow-popups-to-escape-sandbox to permit link navigation

Why

The HTML email preview iframe had a fully sandboxed environment (sandbox=""), which prevented any links in rendered emails from being clickable. This made it impossible to test or interact with links in received emails.

By injecting a base target and relaxing the sandbox security policy to allow popups, links become functional while still maintaining security by opening them in a separate browsing context (new tab) rather than within the iframe.

Test Plan

  • Send a test email with HTML containing links (e.g., <a href="https://example.com">Click here</a>)
  • Open the trap-smtp UI and view the received email
  • Verify that clicking links in the HTML preview opens them in a new browser tab
  • Confirm that the sandbox still prevents other potentially dangerous behaviors (scripts, forms, etc.)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the trap-smtp web UI HTML email preview so links in rendered HTML emails can be clicked and open in a new tab.

Changes:

  • Injects a <base target="_blank"> tag into the HTML email body before rendering in an iframe.
  • Relaxes the preview iframe sandbox policy to allow opening popups/tabs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Inject <base target="_blank"> into HTML previews and relax the
iframe sandbox to allow-popups so that links inside rendered
emails are clickable and open in a new browser tab.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lambdalisue lambdalisue merged commit 029d4dd into main Feb 16, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants