Fix email formatting: send HTML via text field, allow light HTML in support replies

This commit is contained in:
Hoid 2026-02-17 22:29:18 +00:00
parent e92f1f89a8
commit 2070a60d29
2 changed files with 12 additions and 12 deletions

View file

@ -123,12 +123,14 @@ async function cmdReply(args) {
process.exit(1); process.exit(1);
} }
// FreeScout body field is HTML — convert plain text newlines to <br> tags // FreeScout API text field: convert plain text to HTML so emails render with line breaks
const htmlBody = message.replace(/\n/g, '<br>\n'); const htmlText = message
.split(/\n{2,}/)
.map(para => `<p>${para.replace(/\n/g, '<br>')}</p>`)
.join('');
const body = { const body = {
type: draft ? 'note' : 'message', type: draft ? 'note' : 'message',
text: message, text: htmlText,
body: htmlBody,
user: 6, user: 6,
status: status || (draft ? undefined : 'active'), status: status || (draft ? undefined : 'active'),
}; };

View file

@ -129,15 +129,13 @@ The support agent should:
5. Log all interactions in `projects/business/memory/support-log.md` 5. Log all interactions in `projects/business/memory/support-log.md`
**Email formatting rules (MANDATORY):** **Email formatting rules (MANDATORY):**
- FreeScout sends plain text, NOT HTML. Markdown does NOT render. - The CLI auto-converts plain text to HTML (newlines become paragraphs/line breaks).
- NEVER use `**bold**`, `*italic*`, `[links](url)`, or any markdown in replies. - Write replies as plain text with blank lines between paragraphs — the tool handles the rest.
- Use CAPS for emphasis (e.g., "WHAT HAPPENED" not "**What happened**"). - You CAN use light HTML for emphasis: `<b>bold</b>`, `<ul><li>` lists, `<a href="">` links.
- Use plain URLs (e.g., "Visit https://docfast.dev" not "[DocFast](https://docfast.dev)"). - NEVER use markdown (`**bold**`, `- bullets`, `[links](url)`) — it will NOT render.
- USE LINE BREAKS BETWEEN PARAGRAPHS AND SECTIONS. Never send a wall of text. - USE LINE BREAKS BETWEEN PARAGRAPHS AND SECTIONS. Never send a wall of text.
- Each section/topic gets its own paragraph with a blank line before it. - Short paragraphs (2-3 sentences max per block).
- Use short paragraphs (2-3 sentences max per block). - Keep it clean and readable — imagine reading it on a phone.
- Use dashes or plain text lists for structure, not markdown bullets.
- Keep it clean and readable as raw plain text — imagine reading it on a phone.
Never let support tickets go unanswered. Response time matters for customer trust. Never let support tickets go unanswered. Response time matters for customer trust.