Send Single Message action cannot send HTML: no HTMLBody param, so HTML is delivered as plain text

Aperta
#6,761 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
sql, typescript
Ambito
api, backend

Direzione di ricerca

Start with packages/Actions/CoreActions/src/custom/communication/send-single-message.action.ts and trace how its declared ActionParam rows are added through a migration. Then check packages/Communication/engine/src/BaseProvider.ts and the MSGraphProvider content type selection. Done means the action accepts HTMLBody, maps it to Message.HTMLBody, and the migration adds the corresponding input row.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

__SendSingleMessage has no HTML body parameter, so any HTML passed to it is delivered as plain text. The recipient sees raw markup.

Checked on lts/6.2 (v6.2.1-9-gb61ac29) and on next (7cfca02, 2026-11-18). Both have the same gap.

The chain
  1. packages/Actions/CoreActions/src/custom/communication/send-single-message.action.ts:54-60 builds its Message from four params — Subject, Body, To, From. There is no HTMLBody, and the action's declared ActionParam rows are exactly Body, From, MessageType, Provider, Subject, To, so no spelling of an input reaches Message.HTMLBody.
  2. With no HTMLBody and no template, packages/Communication/engine/src/BaseProvider.ts:89 leaves ProcessedHTMLBody as '':
    this.ProcessedHTMLBody = this.HTMLBody || this.ProcessedHTMLBody || '';
    
  3. Providers then choose the content type from that field. packages/Communication/providers/MSGraph/src/MSGraphProvider.ts:413:
    contentType: message.ProcessedHTMLBody ? 'HTML' : 'Text',
    content: message.ProcessedHTMLBody || message.ProcessedBody
    
    So Graph is told Text and handed the markup.
Reproduction

Run the action with Provider: Microsoft Graph, MessageType: Email, and Body set to <p>hello</p>. The action returns SUCCESS, the message is delivered, and the body reads <p>hello</p> literally. The MJ: Communication Logs row confirms where it went: the markup is in MessageContent.TextBody and MessageContent.HTMLBody is empty.

Why it matters

The action is the documented way to send one message without building a Template, and it is what an Action-type Scheduled Job or an agent reaches for. Today an HTML email is only possible through a BodyTemplate carrying HTML content — a template per message shape, which is a lot of metadata for a body an agent already rendered in code. There is also no failure signal: the action reports success and the provider accepts the message, so the defect is only visible in the recipient's inbox.

Proposed fix

Accept an HTMLBody param and map it onto the message:

const htmlBody = params.Params.find(p => p.Name.trim().toLowerCase() === 'htmlbody');
// ...
const m: Message = {
    MessageType: mt,
    From: from.Value,
    To: to.Value,
    Subject: subject?.Value,
    Body: body?.Value,
    HTMLBody: htmlBody?.Value,
}

Message.HTMLBody already exists on the base contract (packages/Communication/engine/src/BaseProvider.ts:70) and every provider already keys its content type off the processed form of it, so nothing downstream needs to change.

Two notes for whoever picks this up:

  • The action's inputs are metadata, so the fix is a code change plus a migration adding the HTMLBody ActionParam row to the Send Single Message action. Without the row, a caller passing HTMLBody may have it dropped before InternalRunAction sees it.
  • Keeping Body as the plain-text alternative and HTMLBody as the HTML one matches what StartLog already records per message (TextBody and HTMLBody in MessageContent), so the log becomes self-describing once both are set.
Lingua principale
TSQL
Stelle
32
Fork
7
Merge medio
1g 16h
PR unite (30g)
504

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MemberJunction/MJ

Tutte le issue di MemberJunction/MJ

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.