server: add Letterbox/Bad label to unparsable emails, and consider them processed

This commit is contained in:
Bill Thiede 2025-04-23 14:57:13 -07:00
parent dfa80f9046
commit c3835522b2

View File

@ -992,7 +992,17 @@ pub async fn label_unprocessed(
let file = File::open(&path)?;
info!("parsing {path}");
let mmap = unsafe { MmapOptions::new().map(&file)? };
let m = info_span!("parse_mail", path = path).in_scope(|| parse_mail(&mmap))?;
let m = match info_span!("parse_mail", path = path).in_scope(|| parse_mail(&mmap)) {
Ok(m) => m,
Err(err) => {
error!("Failed to parse {path}: {err}");
let t = "Letterbox/Bad";
nm.tag_add(t, &id)?;
let t = "unprocessed";
nm.tag_remove(t, &id)?;
continue;
}
};
let (matched_rule, add_tags) = find_tags(&rules, &m.headers);
if matched_rule {
if dryrun {