IMAP4 SEARCH question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Laszlo Nagy

    #1

    IMAP4 SEARCH question

    Hi,

    I'm using imaplib to access an IMAP4 server. I'm reading the IMAP4
    specification, and I found something odd. The search command can be
    used in conjuction with date values. For example, I would like to search
    for messages that are older than 30 days. However, the IMAP4 specs does
    not define date/time type(s). Here is a link:

    The Internet Message Access Protocol, Version 4rev1 (IMAP4rev1) allows a client to access and manipulate electronic mail messages on a server. IMAP4rev1 permits manipulation of mailboxes (remote message folders) in a way that is functionally equivalent to local folders. IMAP4rev1 also provides the capability for an offline client to resynchronize with the server. IMAP4rev1 includes operations for creating, deleting, and renaming mailboxes, checking for new messages, permanently removing messages, setting and clearing flags, RFC 2822 and RFC 2045 parsing, searching, and selective fetching of message attributes, texts, and portions thereof. Messages in IMAP4rev1 are accessed by the use of numbers. These numbers are either message sequence numbers or unique identifiers. IMAP4rev1 supports a single server. A mechanism for accessing configuration information to support multiple IMAP4rev1 servers is discussed in RFC 2244. IMAP4rev1 does not specify a means of posting mail; this function is handled by a mail transfer protocol such as RFC 2821. [STANDARDS-TRACK]


    As you can see, there are some types: NIL, Number, String and
    Parenthesized List. So how do I specify a date? If it is encapsulated in
    a string, then what format should I use? The the RFC contains an example:

    The Internet Message Access Protocol, Version 4rev1 (IMAP4rev1) allows a client to access and manipulate electronic mail messages on a server. IMAP4rev1 permits manipulation of mailboxes (remote message folders) in a way that is functionally equivalent to local folders. IMAP4rev1 also provides the capability for an offline client to resynchronize with the server. IMAP4rev1 includes operations for creating, deleting, and renaming mailboxes, checking for new messages, permanently removing messages, setting and clearing flags, RFC 2822 and RFC 2045 parsing, searching, and selective fetching of message attributes, texts, and portions thereof. Messages in IMAP4rev1 are accessed by the use of numbers. These numbers are either message sequence numbers or unique identifiers. IMAP4rev1 supports a single server. A mechanism for accessing configuration information to support multiple IMAP4rev1 servers is discussed in RFC 2244. IMAP4rev1 does not specify a means of posting mail; this function is handled by a mail transfer protocol such as RFC 2821. [STANDARDS-TRACK]


    BEFORE <date>
    Messages whose internal date (disregarding time and timezone)
    is earlier than the specified date.

    Example: C: A282 SEARCH FLAGGED SINCE 1-Feb-1994 NOT FROM "Smith"
    S: * SEARCH 2 84 882


    But of course I cannot tell what is the date format. I would like to use
    ISO8601 if possible. It is easy (at least from python) and it is well
    standardized. But will the IMAP4 server understand it? Okay, I know that
    I can try this with my IMAP server. But how strange it is that the RFC
    does not define the accepted date formats? Will my program work with any
    IMAP server? If any of you have experience with this, please respond.

    (I'm sorry, I know it is not strictly related to Python, it is more
    likely an RFC/IMAP question.)

    Best,

    Laszlo


Working...