[GMail] [Filtering] GMail could not parse BEFORE stanza on labels
I want to create a periodical cleanup tasks for my GMail account because I getting a gigaton of emails per day that are important but expires after a certain period - this is not a concept that GMail can currently understand.
I started to work with the following script:
options.subscribe = true
account1 = IMAP {
server = 'imap.gmail.com',
username = '******************',
password = '*********',
ssl = 'auto',
}
-- results = account1['Monitoring']:arrived_before('2023-01-01')
results = account1['Monitoring']:sent_before('2023-01-01')
results:mark_seen()
I tried with both arrived_before() and sent_before() stanzas, but GMail does not comprehend them:
S (4): * OK Gimap ready for requests from 2a01:36d:114:461f:6c2d:8c22:b69f:1d11 n16mb117086072wmq
C (4): 1000 CAPABILITY
S (4): 1000 OK Thats all she wrote! n16mb117086072wmq
C (4): LOGIN * *
S (4): 1001 OK ******************* authenticated (Success)
C (4): 1002 CAPABILITY
S (4): 1002 OK Success
C (4): 1003 NAMESPACE
S (4): 1003 OK Success
C (4): 1004 SELECT "Monitoring"
S (4): 1004 OK [READ-WRITE] Monitoring selected. (Success)
C (4): 1005 UID SEARCH ALL BEFORE 2023-01-01
S (4): 1005 BAD Could not parse command
imapfilter: IMAP (4): 1005 BAD Could not parse command
C (4): 1006 LOGOUT
S (4): 1006 OK 73 good day (Success)
and
S (3): * OK Gimap ready for requests from 2a01:36d:114:461f:6c2d:8c22:b69f:1d11 c1mb74818003wrx
C (3): 1000 CAPABILITY
S (3): 1000 OK Thats all she wrote! c1mb74818003wrx
C (3): LOGIN * *
S (3): 1001 OK ******************* authenticated (Success)
C (3): 1002 CAPABILITY
S (3): 1002 OK Success
C (3): 1003 NAMESPACE
S (3): 1003 OK Success
C (3): 1004 SELECT "Monitoring"
S (3): 1004 OK [READ-WRITE] Monitoring selected. (Success)
C (3): 1005 UID SEARCH ALL SENTBEFORE 2023-01-01
S (3): 1005 BAD Could not parse command
imapfilter: IMAP (3): 1005 BAD Could not parse command
C (3): 1006 LOGOUT
S (3): 1006 OK 73 good day (Success)
Could you please take a look into this issue and let me know what I do wrong? According to your documentation, this should work.
Seems it's the date format used, try with '01-Jan-2023'.
From imapfilter_config(5):
The following methods can be used to search for messages based on their arrival or sent date, in the “day-month-year” form, where day is the day of the month as a decimal number (01-31), month is the abbreviated month ( “Jan”, “Feb”, “Mar”, “Apr”, “May”, “Jun”, “Jul”, “Aug”, “Sep”, “Oct”, “Nov”, “Dec”) and year is the year as decimal number including the century (e.g. 2007):