[Email-SIG] Cloning a message

Barry Warsaw barry at python.org
Tue Apr 17 14:26:50 CEST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Apr 17, 2007, at 7:34 AM, Nicholas Cole wrote:

> I've been scratching my head over this problem (in part thinking about
> the PGP/MIME RFC), and although it seems that it ought to have a
> trivial solution, I can't work out what it should be.
>
> How do I take all the parts of Message A, and attach them to a new
> message object?  I don't want to preserve the email headers
> themselves, only the MIME parts.

Untested, perhaps something like:

if msg.is_multipart():
    for part in msg.get_payload():
        newmsg.attach(part)

- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iQCVAwUBRiS9EXEjvBPtnXfVAQIX9AP+I4hUnn0appV8B0H0nYtwQhVJuJ++PbSW
B+0aw9aKpXCi3ZS/hU+Xcm+pPCwHyoX7XRZ8qPlMAd4DfB/Sua+31ug+ZyAOFBq7
3xVj2KxQ4BKGzXVCAaIedzsC9RGeCHNAWVitdZV0ydEDHnjAuJ8G3Mpi//HLB1YV
nvjRc7OT1nw=
=hXZu
-----END PGP SIGNATURE-----


More information about the Email-SIG mailing list