Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching Emails from office 365 raises error 11 when searching for keywords #181

Closed
CarrotManMatt opened this issue Aug 2, 2022 · 4 comments
Labels

Comments

@CarrotManMatt
Copy link

CarrotManMatt commented Aug 2, 2022

Attempting to fetch emails from an Office 365 IMAP MailBox raises this error code when searching for any keyword:
imaplib.IMAP4.error: SEARCH command error: BAD [b'Command Argument Error. 11']

This is my code:

with MailBox("outlook.office365.com").login(test@outlook.com, p4s5w0rd) as mailbox:
        for message in mailbox.fetch(A(keyword="TEST"), miss_no_uid=True, headers_only=True):
            print(message.from_)
@ikvk
Copy link
Owner

ikvk commented Aug 2, 2022

Seems that office 365 not supports keyword arg

@ikvk ikvk added the question label Aug 2, 2022
@CarrotManMatt
Copy link
Author

CarrotManMatt commented Aug 2, 2022

Ok, thanks! What would you suggest is the best flag to use (that office 365 supports) to mark an email as processed (i.e. flag is false by default then set to true).

The other quirk/issue that may be related is that I can fetch emails given the other search criteria (e.g. flagged, seen, answered), but cannot change the values using the mailbox.flag() function?

@ikvk
Copy link
Owner

ikvk commented Aug 3, 2022

  1. check mark_seen arg
  2. mail server may not support some features
  3. I offen use moving processed mails to another folder, this is more robust

@ikvk ikvk closed this as completed Aug 3, 2022
@CarrotManMatt
Copy link
Author

Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants