Email.write_preview_email

Email.write_preview_email(out_file='preview_email.html')

Write a preview HTML file with inline attachments embedded.

This method replaces image sources in the HTML with base64-encoded data from inline attachments, allowing you to preview the email as it would appear to recipients. The generated HTML is self-contained with base64 data URIs, distinct from the email sent via egress.py which uses cid references with MIME attachments.

Parameters

out_file : str = 'preview_email.html'

The file path to write the preview HTML. Defaults to “preview_email.html”.

Returns

: None

Examples

email.write_preview_email("preview.html")

Notes

Raises ValueError if external attachments are present, as preview does not support them.