[elspy] Method for replacing headers?

Greg Ward gward@python.net
Mon, 11 Nov 2002 12:31:19 -0500


On 08 November 2002, Hy Ginsberg said:
> Here's what we're thinking (here at LiveData, in Cambridge, Mass, where
> we're psyched to be plugging Python code into our mailserver with elspy -
> thank you very much)

Great -- glad to hear it's useful to someone other than me!

> aside from the usual virus scanning, it would be nice
> to append a ".txt" to certain filename attachments - for example if an
> attached file ends in ".exe" or ".bat".  That way if someone carelessly
> double-clicked on an attached file, they wouldn't automatically be running
> something potentially nasty.

If you're going to be passing junk mail on to users, then why bother
with local_scan() in the first place?  Might as well just pipe all your
mail through a script that makes whatever changes you want.  The real
reason to write a local_scan() is so that you can *reject* junk mail,
thereby foisting it off onto the spammer/open relay/infected PC/dumb ISP
relay that sent it to your server in the first place.

> I think that means replacing the
> "Content-Disposition" header or maybe just replacing the "filename"
> parameter of the Content-Disposition header, if you wanted to expose that
> level of control.

If the virus really is the whole message then yes, you'd need to modify
message headers.  But viruses are usually attachements, in which case
the Content-Disposition "header" that you want to modify is in the body
of the message.  Exim's manual doesn't have much to say on the matter,
but what it does say is not very hopeful:

  [...] The file is open for reading and writing, but updating it is not
  recommended.
-- 
Greg Ward <gward@python.net>                         http://www.gerg.ca/
Gee, I feel kind of LIGHT in the head now, knowing I can't make my
satellite dish PAYMENTS!