1.3 KiB
1.3 KiB
Attachment Keyword Detection — Configuration
The system warns users when email content implies an attachment (e.g. "please find attached") but no file is attached.
Configuration file
configurations/attachment_keywords.json (must be declared in pubspec.yaml under assets):
{
"includeList": ["invoice", "estimate", "báo giá"],
"excludeList": ["signature-logo", "no-reply", "icon-app"]
}
| Field | Purpose |
|---|---|
includeList |
Add custom keywords to the built-in multi-language dictionary (case-insensitive) |
excludeList |
Suppress false positives — tokens matched here are ignored even if they contain a keyword |
How it works
- On "Send", if the user already has an attachment, the check is skipped entirely.
- Email HTML is converted to plain text (signatures, quotes, and HTML stripped).
includeListis merged with the built-in dictionary; a Unicode-aware Regex is built (cached).- Each match is validated against
excludeListusing full surrounding token context. - If keywords remain and no file is attached, a warning dialog is shown.
Sync/Async: Emails < 20,000 chars run synchronously; larger emails offload to a Dart Isolate via compute().
Cache: Config and Regex pattern are cached in memory; both cleared on logout.