Be more clear on the mail deleted
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
parent
a01b10a01f
commit
792d27d9eb
1 changed files with 3 additions and 1 deletions
|
@ -24,6 +24,7 @@ fn fetch_inbox_top() -> imap::error::Result<Option<String>> {
|
||||||
.map_err(|e| e.0)?;
|
.map_err(|e| e.0)?;
|
||||||
let inbox = imap_session.select("Inbox")?;
|
let inbox = imap_session.select("Inbox")?;
|
||||||
let re = Regex::new(format!("({})+", &pattern).as_str()).unwrap();
|
let re = Regex::new(format!("({})+", &pattern).as_str()).unwrap();
|
||||||
|
let subject = Regex::new(r"Subject: (.*)").unwrap();
|
||||||
for i in 1 as u32..inbox.exists {
|
for i in 1 as u32..inbox.exists {
|
||||||
|
|
||||||
let messages = imap_session.fetch( (inbox.exists-i).to_string(), "RFC822")?;
|
let messages = imap_session.fetch( (inbox.exists-i).to_string(), "RFC822")?;
|
||||||
|
@ -38,7 +39,8 @@ fn fetch_inbox_top() -> imap::error::Result<Option<String>> {
|
||||||
.to_string();
|
.to_string();
|
||||||
if re.is_match(&body) {
|
if re.is_match(&body) {
|
||||||
imap_session.store(format!("{}", message.message), "+FLAGS (\\Deleted)").unwrap();
|
imap_session.store(format!("{}", message.message), "+FLAGS (\\Deleted)").unwrap();
|
||||||
println!("DELETED SPAM Target!");
|
let subject_re = subject.captures(&body).unwrap();
|
||||||
|
println!("Deleted Mail with Subject: {}", &subject_re[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
imap_session.expunge().unwrap();
|
imap_session.expunge().unwrap();
|
||||||
|
|
Loading…
Reference in a new issue