The short answer
Pass anhtml field to messages.send() alongside the plain text fallback. Email clients that support HTML will render the rich version; older clients and screen readers fall back to plain text. Always send both.
Why plain text is not enough
When your agent sends a support reply, a sales follow-up, or a weekly digest, plain text looks like spam. Recipients expect formatted emails — bold text for emphasis, links that are clickable, tables for data, and a visual structure that signals “this is a real business email.” Plain text also loses information. A bulleted action list becomes a wall of dashes. A table of invoice line items becomes unreadable. HTML lets your agent communicate with the same fidelity a human would.Sending HTML with the SDK
Both the TypeScript and Python SDKs accepthtml and text on messages.send(). Always provide both — text is the accessibility fallback and is used by spam filters to validate content consistency.
Inline styles are mandatory
Email clients strip<style> tags. Gmail removes them entirely. Outlook ignores them. Yahoo strips them on mobile. This is the single biggest gotcha in HTML email development.
Every CSS property must be applied inline via the style attribute:
Building a template system
For agents that send recurring emails (digest reports, status updates, ticket resolutions), build a template function that your agent calls before sending. This keeps HTML out of your LLM prompts and ensures visual consistency.Responsive design basics
Most emails are read on mobile. Keep layouts simple and they will naturally adapt:- Set a max-width of 600px on your outer container. This is the universal safe width for email.
- Use a single-column layout. Multi-column layouts break on mobile Outlook and small screens.
- Set font sizes to at least 14px. Anything smaller gets auto-zoomed on iOS, breaking your layout.
- Use percentage widths for tables (
width: 100%) so they scale down on narrow screens. - Test with real inboxes. Send a test email to Gmail, Outlook, and Apple Mail before going live.
Related
Messages
Full API reference for sending emails including HTML, attachments, and threading.
Email Signatures for Agents
Append consistent HTML signatures to every agent email.
Attaching Files
Upload and attach files to outbound agent emails.

