rfc822 module: deleting headers

Tim Roberts timr at probo.com
Wed May 22 02:10:48 EDT 2002


"Jason R. Mastaler" <jason-dated-1022700360.9a9240 at mastaler.com> wrote:

>This question concerns how to remove headers from an incoming mail
>message using the rfc822 module.  The docs say:
>
>    Message instances also support the mapping writable interface
>    m[name] = value and del m[name].

Yes, but all this does is alter the copy of the message in memory.  It
doesn't change any files.

>So take the following program invoked from a .qmail file (qmail's
>equivalent of .forward):

I don't know about .qmail, but sendmail's .forward cannot be used to filter
e-mail.  You can read the message, send it somewhere else, store it to
file, or do other things, but you can't alter the message on its way to
your local mailbox.  Indeed, in your example, you didn't DO anything with
your altered message.  You read it from stdin and modified it in memory,
but you didn't write it anywhere.

You might want to investigate procmail.  It is designed for this kind of
application.  If .qmail is supposed to support the same kind of
functionality, then you need to figure out where you are supposed to WRITE
the modified message.
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list