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);
}
// FreeScout body field is HTML — convert plain text newlines to <br> tags
const htmlBody = message.replace(/\n/g, '<br>\n');
// FreeScout API text field: convert plain text to HTML so emails render with line breaks
const htmlText = message
.split(/\n{2,}/)
.map(para => `<p>${para.replace(/\n/g, '<br>')}</p>`)
.join('');
const body = {
type: draft ? 'note' : 'message',
text: message,
body: htmlBody,
text: htmlText,
user: 6,
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`
**Email formatting rules (MANDATORY):**
- FreeScout sends plain text, NOT HTML. Markdown does NOT render.
- NEVER use `**bold**`, `*italic*`, `[links](url)`, or any markdown in replies.
- Use CAPS for emphasis (e.g., "WHAT HAPPENED" not "**What happened**").
- Use plain URLs (e.g., "Visit https://docfast.dev" not "[DocFast](https://docfast.dev)").
- The CLI auto-converts plain text to HTML (newlines become paragraphs/line breaks).
- Write replies as plain text with blank lines between paragraphs — the tool handles the rest.
- You CAN use light HTML for emphasis: `<b>bold</b>`, `<ul><li>` lists, `<a href="">` links.
- NEVER use markdown (`**bold**`, `- bullets`, `[links](url)`) — it will NOT render.
- 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.
- Use short paragraphs (2-3 sentences max per block).
- 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.
- Short paragraphs (2-3 sentences max per block).
- Keep it clean and readable — imagine reading it on a phone.
Never let support tickets go unanswered. Response time matters for customer trust.