mail icon indicating copy to clipboard operation
mail copied to clipboard

Support absolute paths in setHTMLBody for automatic CID embedding

Open Kaczmi opened this issue 3 months ago • 0 comments

  • bug fix / new feature? not sure
  • BC break? yes

Currently, setHTMLBody in Nette\Mail supports a basePath for automatically embedding local images as CID attachments. Relative paths like img/logo.svg work correctly, but absolute paths starting with a slash (e.g. /img/logo.svg) are ignored and not embedded.

This PR updates the logic so that images referenced with a leading slash are correctly resolved relative to the provided basePath, allowing projects that use Webpack-generated assets (which always output to a fixed public folder with leading slashes) to work without breaking existing templates that rely on relative paths.

Here, basePath for mails is intended to represent the www folder of the application, making it clear that absolute paths are resolved relative to the web root.

Kaczmi avatar Oct 09 '25 13:10 Kaczmi