mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Handle tags for gmail email accounts
like mentioned here: https://github.com/ikvk/imap_tools/issues/174
This commit is contained in:
parent
0878a199f4
commit
edabf208bc
@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import tempfile
|
import tempfile
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
@ -70,7 +71,11 @@ class TagMailAction(BaseMailAction):
|
|||||||
return {"no_keyword": self.keyword}
|
return {"no_keyword": self.keyword}
|
||||||
|
|
||||||
def post_consume(self, M: MailBox, message_uids, parameter):
|
def post_consume(self, M: MailBox, message_uids, parameter):
|
||||||
M.flag(message_uids, [self.keyword], True)
|
if re.search(r"gmail\.com$|googlemail\.com$", M._host):
|
||||||
|
for uid in message_uids:
|
||||||
|
M.client.uid("STORE", uid, 'X-GM-LABELS', self.keyword)
|
||||||
|
else:
|
||||||
|
M.flag(message_uids, [self.keyword], True)
|
||||||
|
|
||||||
|
|
||||||
def get_rule_action(rule):
|
def get_rule_action(rule):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user