Commit 1d10e021 authored by kaiyou's avatar kaiyou

Checkpoint and expunge imap mailboxes

parent e045594c
Pipeline #198 passed with stage
in 59 seconds
......@@ -69,19 +69,21 @@ def send_then_receive(context, account_from, account_to, timeout=120):
)
client.login(account_to["username"], account_to["password"])
client.select(account_to["inbox"])
filter_string = f'(UNSEEN SUBJECT "{canary}")'
filter_string = f'UNSEEN SUBJECT {canary}'
delay = 0
while delay < timeout:
status, data = client.uid("search", None, filter_string)
delay = int(time.time() - start_time)
if status == "OK" and data[0]:
for uid in data[0].split():
client.uid("store", uid, "+FLAGS", "(\\Seen)")
client.uid("store", uid, "+FLAGS", "(\\Deleted)")
client.expunge()
result["up"] = True
result["delay"] = delay
result["message"] = f"message delivered in {delay} seconds"
break
time.sleep(10)
client.check()
if "up" not in result:
result["up"] = False
domain = account_to["username"].split("@")[1]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment