[issue31524] mailbox._mboxMMDF.get_message throws away From envelope

2022-01-16 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.5, Python 3.6, Python 
3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31524] mailbox._mboxMMDF.get_message throws away From envelope

2017-09-19 Thread R. David Murray

R. David Murray added the comment:

It just needs to call set_unixfrom as well as set_from.  I don't know why the 
MMDFMessage tracks it separately, but I'm sure the author had a reason that 
seemed good at the time :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31524] mailbox._mboxMMDF.get_message throws away From envelope

2017-09-19 Thread bpoaugust

bpoaugust added the comment:

I believe that setting the file back to the start is probably the best solution.

The message as provided by e.g. postfix will include the From header and the 
parser is able to deal with that successfully, so I'm not sure why the mbox 
reader removes it before calling the parser. It only really needs to drop the 
trailing newline to ensure that the parser gets the same data.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31524] mailbox._mboxMMDF.get_message throws away From envelope

2017-09-19 Thread bpoaugust

bpoaugust added the comment:

It is not saving the unix from line.

#!/usr/bin/env python3

with open("test.mbox",'w') as f:
f.write("From sender@invalid Thu Nov 17 00:49:30 2016\n")
f.write("Subject: Test\n")
f.write("\n")
f.write("\n")

import mailbox
messages = mailbox.mbox("test.mbox")
for msg in messages:
print(msg.get('subject'))
print(msg.get_from())
print(msg.get_unixfrom())

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31524] mailbox._mboxMMDF.get_message throws away From envelope

2017-09-19 Thread R. David Murray

R. David Murray added the comment:

It looks like it is saving it (the set_from line).  Do you have a test that 
proves otherwise?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31524] mailbox._mboxMMDF.get_message throws away From envelope

2017-09-19 Thread bpoaugust

New submission from bpoaugust:

https://github.com/python/cpython/blob/master/Lib/mailbox.py#L778

The code here reads the first line, but fails to save it as the unixfrom line.

Alternatively perhaps it should reset the file back to the start so the message 
factory has sight of the envelope.

The end result is that the envelope is lost.

--
components: email
messages: 302570
nosy: barry, bpoaugust, r.david.murray
priority: normal
severity: normal
status: open
title: mailbox._mboxMMDF.get_message throws away From envelope
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com