I use this with the Gmail SMTP server, and I would like to search through IMAP for emails sent or received from the address.
This is what I have:
mail = imaplib.IMAP4_SSL('imap.gmail.com') mail.login('user', 'pass') mail.list() mail.select("[Gmail]/All Mail") status, email_ids = mail.search(None, 'TO " tech163@fusionswift.com " OR FROM " tech163@fusionswift.com "')
Last line of error: imaplib.error: SEARCH command error: BAD ['Could not parse command']
Not sure how I should do this OR statement in python imaplib
. If someone can quickly explain what is wrong or point me in the right direction, it would be very helpful.
source share