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

folders with spaces in the name #291

Closed
enaut opened this issue May 21, 2024 · 2 comments
Closed

folders with spaces in the name #291

enaut opened this issue May 21, 2024 · 2 comments

Comments

@enaut
Copy link
Contributor

enaut commented May 21, 2024

I'd like to receive mails from the Junk Mail folder. However, when I try to get the messages from that mailbox, I get an error:

Request Method: 	POST
Request URL: 	http://127.0.0.1:8000/admin/django_mailbox/mailbox/
Django Version: 	5.0.6
Exception Type: 	error
Exception Value: 	

SELECT command error: BAD [b"Unexpected value 'Mail'."]

Exception Location: 	/usr/lib64/python3.12/imaplib.py, line 1055, in _command_complete

The URL I used:

imap+ssl://solawis-dev%40domain.de:repassword%5DN%2Ce9B@domain.de?archive=Archived&folder=Junk%20Mail

Should that work or am I using this wrong?

@pfouque
Copy link
Collaborator

pfouque commented May 21, 2024

Hi @enaut ,
As far as i can see, the issue is related to imaplib and It seems to be a pretty common issue.
I didn't test but it seems you. have to quote the folder in the url when it contains spaces: ?archive=Archived&folder="Junk Mail". Once encoded properly it should give you an url like that:
imap+ssl://solawis-dev%2540domain.de%3Arepassword%255DN%252Ce9B%40domain.de%3Farchive%3DArchived%26folder%3D%22Junk%20Mail%22

@enaut
Copy link
Contributor Author

enaut commented May 21, 2024

You were right but you encoded too much only the quotes need to be encoded not the equals sign and all the previous special characters:

imap+ssl://solawis-dev%40domain.de:repassword%5DN%2Ce9B@domain.de?archive=Archived&folder=%22Junk%20Mail%22

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