* Detects whether an email is a forwarded message based on subject/body patterns.
(subject: string | null, body: string | null)
| 89 | * Detects whether an email is a forwarded message based on subject/body patterns. |
| 90 | */ |
| 91 | function isForwardedEmail(subject: string | null, body: string | null): boolean { |
| 92 | if (subject && FORWARDED_PATTERNS.some((p) => p.test(subject))) return true |
| 93 | if (body && FORWARDED_PATTERNS.some((p) => p.test(body.substring(0, 500)))) return true |
| 94 | return false |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Repeatedly applies a regex replacement until the string stabilises. |
no test coverage detected