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

Bad quote_re #10

Closed
viric opened this issue Nov 18, 2010 · 4 comments
Closed

Bad quote_re #10

viric opened this issue Nov 18, 2010 · 4 comments

Comments

@viric
Copy link

viric commented Nov 18, 2010

I noticed the quote_re failed for a letter I have. It has the quoted text:

"blablabla"

I updated quote_re in simpleimap.py to get it working to this:
quoted_re = re.compile(r'^"((?:[^"]|(?:\)|"|))"')
while you had:
quoted_re = re.compile(r'^"((?:[^"]|"|)
?)"')

Do you think it will work?

Notice that I did not understand the last '?' you had so I removed it.

@rtucker
Copy link
Owner

rtucker commented Nov 23, 2010

I added a test to testsuite.py, based on sending myself an e-mail with a Subject of:

test message "blablabla\\" test message

However, it works OK with the quoted_re as it is, so I don't necessarily think I'm testing it right. Assuming the message is in your inbox (and you're using gmail :-), and you know which message it is, can you try:

import simpleimap
imap = simpleimap.SimpleImapSSL('imap.gmail.com')
imap.login('your_username@gmail.com', 'yourpassword')
imap.select('INBOX')
# returns ('OK', ['29']), where 29 is the message count
imap.fetch('29', '(ENVELOPE)')
# assuming the 29th message; otherwise, trial and error

This will return something like:

('OK', ['29 (ENVELOPE ("Tue, 23 Nov 2010 12:29:01 -0500" "test message \\"blablabla\\\\\\\\\\" test message" (("Ryan Tucker" NIL "rtucker" "arrogant-bastard.hoopycat.com")) (("Ryan Tucker" NIL "rtucker" "arrogant-bastard.hoopycat.com")) (("Ryan Tucker" NIL "rtucker" "arrogant-bastard.hoopycat.com")) ((NIL NIL "rtucker" "gmail.com")) NIL NIL NIL "<E1PKwft-0002n9-EN@arrogant-bastard.hoopycat.com>"))'])

Feel free to anonymize e-mail addresses and such. I'm mostly interested in the subject part of it. (Also, your guess about the last '?' is as good as mine at this point. It's been awhile!)

@viric
Copy link
Author

viric commented Nov 23, 2010

Hello,
I knew how to test that imap.fetch. It failed for me. Can you check if the backslashes got right into the e-mail source?
Anyway, from the quote_re it is clear that it had to fail, isn't it? :)

@viric
Copy link
Author

viric commented Nov 23, 2010

Additionally, to check the imap, I use to run your program with "python -d" enabling the debug in the imap module. That shows all imap traffic.

@rtucker
Copy link
Owner

rtucker commented Nov 26, 2010

I have committed the new quoted_re in commit f063493 which should be pushed shortly. Thanks :-)

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

No branches or pull requests

2 participants