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
bug with ill-formed rfc822 attachments #39341
Comments
The following proglet gets an except with the attached import email
import sys
msg = email.message_from_file(sys.stdin)
sys.stdout.write(msg.as_string()) python2 te.py <failingmsg
Traceback (most recent call last):
File "te.py", line 4, in ?
msg = email.message_from_file(sys.stdin)
File "/usr/lib/python2.2/email/__init__.py", line 63,
in message_from_file
return Parser(_class, strict=strict).parse(fp)
File "/usr/lib/python2.2/email/Parser.py", line 64,
in parse
self._parsebody(root, fp, firstbodyline)
File "/usr/lib/python2.2/email/Parser.py", line 239,
in _parsebody
msgobj = self.parsestr(part)
File "/usr/lib/python2.2/email/Parser.py", line 75,
in parsestr
return self.parse(StringIO(text),
headersonly=headersonly)
File "/usr/lib/python2.2/email/Parser.py", line 64,
in parse
self._parsebody(root, fp, firstbodyline)
File "/usr/lib/python2.2/email/Parser.py", line 264,
in _parsebody
msg = self.parse(fp)
File "/usr/lib/python2.2/email/Parser.py", line 64,
in parse
self._parsebody(root, fp, firstbodyline)
File "/usr/lib/python2.2/email/Parser.py", line 205,
in _parsebody
raise Errors.BoundaryError(
email.Errors.BoundaryError: No terminating boundary and
no trailing empty line The message/rfc822 attachment really is missing the I suggest that a message attachment that fails MIME Anyway, I get tons of messages with this property that |
Logged In: YES I'm moving this to a feature request for Python 2.4. In the meantime, you could probably derive your own Parser |
Logged In: YES Your disposition makes sense. Since all messages with invalid MIME boundaries are either if exc_type == email.Errors.BoundaryError:
self.setreply('554','5.7.7',
'Boundary error in your message, are you a
spammer?') For 2.4, I recommend that rfc822 attachments be parsed Although the rfc822 module is deprecated, I find it very |
Logged In: YES Note that if you're looking for something that just parses |
I don't see any exception as of Python 2.5. Closing as "fixed". |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: