( body: string, contentType: 'text' | 'html' | undefined )
| 370 | * fallback for clients that don't render HTML. |
| 371 | */ |
| 372 | export function buildBodyAlternatives( |
| 373 | body: string, |
| 374 | contentType: 'text' | 'html' | undefined |
| 375 | ): { plain: string; html: string } { |
| 376 | if (contentType === 'html') { |
| 377 | return { plain: htmlToPlainText(body) || body, html: body } |
| 378 | } |
| 379 | return { plain: body, html: plainTextToHtml(body) } |
| 380 | } |
| 381 | |
| 382 | /** |
| 383 | * Encode a text body as base64 with RFC 2045 line wrapping (max 76 chars). |
no test coverage detected