Fix mail parser
This commit is contained in:
parent
c685ebd3e0
commit
4450a17426
@ -44,13 +44,16 @@ class MailParser:
|
|||||||
if not ct.startswith('multipart/alternative'):
|
if not ct.startswith('multipart/alternative'):
|
||||||
raise Exception('Not yet implemented')
|
raise Exception('Not yet implemented')
|
||||||
|
|
||||||
parser = re.compile('.*boundary="([^"]+)"')
|
parser = re.compile(r'.*boundary=("([^"]+)"|([^ ]+))')
|
||||||
matcher = parser.match(ct)
|
matcher = parser.match(ct)
|
||||||
if matcher is None:
|
if matcher is None:
|
||||||
self._l.error('Cannot extract boundary from mail header.')
|
self._l.error('Cannot extract boundary from mail header.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
boundary = matcher.group(1)
|
if matcher.group(2) is not None:
|
||||||
|
boundary = matcher.group(2)
|
||||||
|
elif matcher.group(3) is not None:
|
||||||
|
boundary = matcher.group(3)
|
||||||
|
|
||||||
return 'multipart/alternative', boundary
|
return 'multipart/alternative', boundary
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user