-
-
Save martinrusev/6121028 to your computer and use it in GitHub Desktop.
| ALL | |
| All messages in the mailbox; the default initial key for | |
| ANDing. | |
| ANSWERED | |
| Messages with the \Answered flag set. | |
| BCC | |
| Messages that contain the specified string in the envelope | |
| structure's BCC field. | |
| BEFORE | |
| Messages whose internal date (disregarding time and timezone) | |
| is earlier than the specified date. | |
| BODY | |
| Messages that contain the specified string in the body of the | |
| message. | |
| CC | |
| Messages that contain the specified string in the envelope | |
| structure's CC field. | |
| DELETED | |
| Messages with the \Deleted flag set. | |
| DRAFT | |
| Messages with the \Draft flag set. | |
| FLAGGED | |
| Messages with the \Flagged flag set. | |
| FROM | |
| Messages that contain the specified string in the envelope | |
| structure's FROM field. | |
| HEADER | |
| Messages that have a header with the specified field-name (as | |
| defined in [RFC-2822]) and that contains the specified string | |
| in the text of the header (what comes after the colon). If the | |
| string to search is zero-length, this matches all messages that | |
| have a header line with the specified field-name regardless of | |
| the contents. | |
| KEYWORD | |
| Messages with the specified keyword flag set. | |
| LARGER | |
| Messages with an [RFC-2822] size larger than the specified | |
| number of octets. | |
| NEW | |
| Messages that have the \Recent flag set but not the \Seen flag. | |
| This is functionally equivalent to "(RECENT UNSEEN)". | |
| NOT | |
| Messages that do not match the specified search key. | |
| OLD | |
| Messages that do not have the \Recent flag set. This is | |
| functionally equivalent to "NOT RECENT" (as opposed to "NOT | |
| NEW"). | |
| ON | |
| Messages whose internal date (disregarding time and timezone) | |
| is within the specified date. | |
| OR | |
| Messages that match either search key. | |
| RECENT | |
| Messages that have the \Recent flag set. | |
| SEEN | |
| Messages that have the \Seen flag set. | |
| SENTBEFORE | |
| Messages whose [RFC-2822] Date: header (disregarding time and | |
| timezone) is earlier than the specified date. | |
| SENTON | |
| Messages whose [RFC-2822] Date: header (disregarding time and | |
| timezone) is within the specified date. | |
| SENTSINCE | |
| Messages whose [RFC-2822] Date: header (disregarding time and | |
| timezone) is within or later than the specified date. | |
| SINCE | |
| Messages whose internal date (disregarding time and timezone) | |
| is within or later than the specified date. | |
| SMALLER | |
| Messages with an [RFC-2822] size smaller than the specified | |
| number of octets. | |
| SUBJECT | |
| Messages that contain the specified string in the envelope | |
| structure's SUBJECT field. | |
| TEXT | |
| Messages that contain the specified string in the header or | |
| body of the message. | |
| TO | |
| Messages that contain the specified string in the envelope | |
| structure's TO field. | |
| UID | |
| Messages with unique identifiers corresponding to the specified | |
| unique identifier set. Sequence set ranges are permitted. | |
| UNANSWERED | |
| Messages that do not have the \Answered flag set. | |
| UNDELETED | |
| Messages that do not have the \Deleted flag set. | |
| UNDRAFT | |
| Messages that do not have the \Draft flag set. | |
| UNFLAGGED | |
| Messages that do not have the \Flagged flag set. | |
| UNKEYWORD | |
| Messages that do not have the specified keyword flag set. | |
| UNSEEN | |
| Messages that do not have the \Seen flag set. |
UID SEARCH HEADER Message-ID <[email protected]>
I wanna add RFC document link https://tools.ietf.org/html/rfc3501#section-6.4.4
is there a link with examples to these?
Do you know of a search key where the first/last email is found?
@tobiasm-1 This will gives you latest uid of email.
client.selectMailbox("INBOX").then((inbox) => {
let numberEmails = inbox.exists;
console.log("# messages: " + numberEmails);
return numberEmails;
})
i'm using the download-email-attachments library and after modified date criterion through the function processMails(node_modules\download-email-attachments\lib\find-emails.js.) from "SINCE" to "UNSEEN" doesnt work.
Someone know why?
Here's one example:
https://stackoverflow.com/a/66906573/10904662
You can use SENTSINCE to get most recent messages
date = (datetime.date.today() - datetime.timedelta(days=2)).strftime("%d-%b-%Y")
typ, messages = m.search(None, '(ALL)', f'(SENTSINCE {date})')
To get only today messages you can use
date = datetime.date.today().strftime("%d-%b-%Y")
Une can as well replace '(ALL)' by '(UNSEEN)' to get only unseen messages
Can you please give me an example for the HEADER <field-name> <string>
field-name is: Authentication-Results
string is: header.i=@
This below is generating errors:
resp_code, mails = imap_ssl.search(None, '(HEADER "Authentication-Results" "header.i=@")')
I want to extract only automatic reply mail body and signature. so, anyone help me please
Link to current RFC: https://datatracker.ietf.org/doc/html/rfc9051#section-6.4.4-14
Can anyone help? I only want to extract emails sent since 8 hour ago.
hey why search function not searching correctly if there are spaces in the subject can anyone tell??
can you give an example with HEADER / UID where we can search with MESSAGE id of the mail?
Any help would be much appreciated. Thanks