server: add Letterbox/Bad label to unparsable emails, and consider them processed
This commit is contained in:
parent
dfa80f9046
commit
c3835522b2
@ -992,7 +992,17 @@ pub async fn label_unprocessed(
|
|||||||
let file = File::open(&path)?;
|
let file = File::open(&path)?;
|
||||||
info!("parsing {path}");
|
info!("parsing {path}");
|
||||||
let mmap = unsafe { MmapOptions::new().map(&file)? };
|
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);
|
let (matched_rule, add_tags) = find_tags(&rules, &m.headers);
|
||||||
if matched_rule {
|
if matched_rule {
|
||||||
if dryrun {
|
if dryrun {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user