Search mailbox for matching messages. (typ, [data]) = .search(charset, criterion, ...) 'data' is space separated list of matching message numbers. If UTF8 is enabled, charset MUST be None.
(self, charset, *criteria)
| 820 | |
| 821 | |
| 822 | def search(self, charset, *criteria): |
| 823 | """Search mailbox for matching messages. |
| 824 | |
| 825 | (typ, [data]) = <instance>.search(charset, criterion, ...) |
| 826 | |
| 827 | 'data' is space separated list of matching message numbers. |
| 828 | If UTF8 is enabled, charset MUST be None. |
| 829 | """ |
| 830 | name = 'SEARCH' |
| 831 | if charset: |
| 832 | if self.utf8_enabled: |
| 833 | raise IMAP4.error("Non-None charset not valid in UTF8 mode") |
| 834 | typ, dat = self._simple_command(name, 'CHARSET', charset, *criteria) |
| 835 | else: |
| 836 | typ, dat = self._simple_command(name, *criteria) |
| 837 | return self._untagged_response(typ, dat, name) |
| 838 | |
| 839 | |
| 840 | def select(self, mailbox='INBOX', readonly=False): |