imapobj search(['all']returns every message in the currently selected folder imapobj search(['on -jul- ']returns every message sent on july imapobj search(['since -jan- ''before -feb- ''unseen']returns every message sent in january that is unread (note that this means on and after january and up to but not including february returns every message from alice@example com sent since the start of imapobj search(['since -jan- ''from alice@example com']imapobj search(['since -jan- ''not from alice@example com']returns every message sent from everyone except alice@example com since the start of imapobj search(['or from alice@example com from bob@example com']returns every message ever sent from alice@example com or bob@example com imapobj search(['from alice@example com''from bob@example com']trick examplethis search never returns any messagesbecause messages must match all search keywords since there can be only one "fromaddressit is impossible for message to be from both alice@example com and bob@example com the search(method doesn' return the emails themselves but rather unique ids (uidsfor the emailsas integer values you can then pass these uids to the fetch(method to obtain the email content continue the interactive shell example by entering the followinguids imapobj search(['since -jul- ']uids [ herethe list of message ids (for messages received july onwardreturned by search(is stored in uids the list of uids returned on your computer will be different from the ones shown herethey are unique to particular email account when you later pass uids to other function callsuse the uid values you receivednot the ones printed in this book' examples size limits if your search matches large number of email messagespython might raise an exception that says imaplib errorgot more than bytes when this happensyou will have to disconnect and reconnect to the imap server and try again sending email and text messages