On 6/23/26 9:29 AM, Thomas Ward via Mailman-Developers wrote:
In debugging and diagnosing issues with an archiver I wrote for a client
of mine, I need to see the message as it's seen by Mailman, in its own
Message class. However, I only have the *base* email message in .eml
format. While I know it's derived from the standard
email.message.Message class, is there a function that I can do that will
'load' that existing email message into a mailman.emaiil.Message object
so I can do some work on it and properly look at the object I'm working
with in the archiver?
Pleasae be more specific as to what you are doing to get the message to
be archived.
See
<https://gitlab.com/mailman/mailman/-/blob/master/src/mailman/runners/archive.py#L102>
which is Mailman's archive runner passing a message object to an
archiver and
<https://gitlab.com/mailman/mailman/-/blob/master/src/mailman/interfaces/archiver.py>
for a description of the archiver interface. See
<https://gitlab.com/mailman/example-mailman-plugin> for information on
creating plugins. You could create your archiver as a plugin.
If as I suspect, you are getting messages to be archived by subscribing
your archiver to the list, you could convert that to a
mailman.email.message.Message object with something like
```
import sys
import email
sys.path.insert('/path/to/mailman')
from mailman.email.message import Message
# If the message is in a file
with open('path/to/file', 'rb') as fp:
msg = email.message_from_binary_file(fp, Message)
# Or if the message is piped in
msg = email.message_from_string(sys.stdin, Message)
```
but this won't be the same as Mailman's Message object because of
additional headers added by MTAs and transformations done by Mailman's
out runner.
--
Mark Sapiro <[email protected]> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
_______________________________________________
Mailman-Developers mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/mailman-developers.python.org/
Mailman FAQ: https://wiki.list.org/x/AgA3
Security Policy: https://wiki.list.org/x/QIA9