编写响应式邮件模板代码
将邮件设计转为适配移动端与主流客户端的完整代码,附兼容取舍说明及渲染测试清单。
完整提示词
<context>
You build HTML emails. Email HTML is not web HTML: classic Outlook for Windows renders with the Word engine, which ignores much modern CSS (flexbox, grid, many margins, background images without special markup), some webmail clients strip `<style>` blocks in certain contexts or rewrite class names, Gmail clips messages whose HTML is over about 102 KB (hiding everything below, often including the unsubscribe link), and dark mode may invert colours in some clients and not others. Reliable emails use nested tables with `role="presentation"`, inline styles for anything critical (with a `<style>` block for media queries and dark mode as progressive enhancement), fixed max-width around 600 to 640 px with fluid fallbacks, bulletproof buttons made from table cells (with conditional VML for Outlook where rounded corners matter), real text instead of text in images, alt text on every image, and `lang` and `dir` on the root. MJML compiles to this kind of markup and is easier to maintain if the team accepts a build step.
</context>
<task>
Code this email.
<design>
{{design}}
</design>
Approach: {{approach}}
{{#audience_clients}}Priority clients: {{audience_clients}}{{/audience_clients}}
1. **Build notes:** list the design decisions you had to make (widths, font stacks with safe fallbacks, how each section stacks on mobile, which effects degrade in Outlook) and any part of the design that will not render reliably, with the compromise you chose.
2. **Code:** produce the full email:
- Document skeleton with doctype, `lang`, meta charset and viewport, the colour-scheme meta tags, and a hidden preheader with spacer.
- Layout in `role="presentation"` tables (or MJML sections and columns), max-width wrapper, mobile stacking via media queries.
- Inline critical styles; `<style>` block only for responsive and dark-mode rules.
- Bulletproof buttons; Outlook conditional comments where needed.
- Images with width, height, alt text and `display:block`; logos that work on dark backgrounds.
- Merge tags or editable regions in the platform's format if supplied, otherwise clear placeholders.
- A footer with unsubscribe and address placeholders.
3. Keep total HTML well below the clipping size and say the approximate size.
4. **Test plan:** the clients and modes to check (priority clients first, plus light and dark mode, mobile and desktop, images off), and what to look for in each.
</task>
<constraints>
- Do not use JavaScript, forms, external CSS files, web fonts without fallbacks, or CSS that the target clients do not support for critical layout.
- Keep text as live text; never put the main message only in an image.
- Do not claim exact client support from memory as fact; mark client-specific fixes as "verify in a rendering test".
- Use placeholders for image URLs and links; do not invent URLs.
</constraints>
<output_format>
## Build notes
Bullets.
## Code
One complete code block (HTML or MJML; if MJML, note the compile step).
## Test plan
A table: Client or mode | What to check.
</output_format>可替换内容
- {{design}}
- {{approach}}
- {{#audience_clients}}
- {{audience_clients}}
- {{/audience_clients}}
分类与标签
编程开发、邮件模板开发、响应式布局、邮件客户端兼容、渲染测试