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

Gmail MailFolders with spaces in their name don't work #5

Open
Ashwagandhae opened this issue Dec 1, 2022 · 2 comments
Open

Gmail MailFolders with spaces in their name don't work #5

Ashwagandhae opened this issue Dec 1, 2022 · 2 comments

Comments

@Ashwagandhae
Copy link

Expected Behavior

Searching Gmail MailFolders with spaces in their names should work the same as MailFolders without spaces.

Actual Behavior

Searching Gmail MailFolders with spaces in their names throws imaplib.error: SELECT command error: BAD [b'Could not parse command'].

  File "/Users/Username/Library/Python/3.9/lib/python/site-packages/redbox/models/mailbox.py", line 51, in search
    self.select()
  File "/Users/Username/Library/Python/3.9/lib/python/site-packages/redbox/models/mailbox.py", line 26, in select
    self.session.select(self.name, readonly=self.readonly)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/imaplib.py", line 756, in select
    typ, dat = self._simple_command(name, mailbox)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/imaplib.py", line 1230, in _simple_command
    return self._command_complete(name, self._command(name, *args))
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/imaplib.py", line 1055, in _command_complete
    raise self.error('%s command error: %s %s' % (name, typ, data))
imaplib.error: SELECT command error: BAD [b'Could not parse command']

Steps to Reproduce the Problem

  1. Run the program below, replacing [email protected] with a real email address, and asdf asdf asdf asdf with a real password
from redbox import gmail

# Set credentials
gmail.username = "[email protected]"
gmail.password = "asdf asdf asdf asdf"
folder = gmail["[Gmail]/All Mail"]
#                       ^^^^^^^^
# Notice the space in folder name

# Search folders
for msg in folder.search(unseen=False):
    print(msg.subject)
    print(msg.text_body)

Note: Running the same program with a MailFolder with no spaces, like [Gmail]/Important, works.

Specifications

  • RedBox: 0.2.1
  • Python: 3.9.6
  • Platform: macOS 13.0
@solanav
Copy link

solanav commented Aug 17, 2023

Hi! I fixed this on my fork solanav/red-box just in case you still need it. You can install my fork with pip install redbox2.

@Ashwagandhae
Copy link
Author

Thanks!

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

No branches or pull requests

2 participants