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'),
};