Test
Merged
SW
4mo ago+254+254+012345678901234567890123456789-15-15-01234567890123456789
Summary by cubic
Make POST /api/emails easier to use by making to and subject optional. When omitted, recipients default to the account’s email(s) and the subject is derived from the body or falls back to "Message from Recoup".
- New Features
tooptional: resolves to the authenticated account’s email(s) viaaccount_emails; 400 if none found.subjectoptional: uses provided value, else first heading/line fromtext(orhtmlwith tags stripped), else "Message from Recoup" (capped at 120 chars).- Added
resolveEmailSubject,firstMeaningfulLine, andstripHtmlhelpers; expanded validator to return resolvedtoandsubject. - Unit tests for subject resolution, HTML stripping, first-line extraction, and validator paths (defaulting and errors).