Sorting Unix mailboxes

William Park opengeometry at yahoo.ca
Thu Sep 15 20:57:19 EDT 2005


sfeil at io.com <sfeil at io.com> wrote:
> I'm writing a program in python to sort the mail in standard Unix
> email boxes. In my "prof of concept" example I am coping a letter to a
> second mailbox if the letter was send from a particular email
> address. When I read the destination mailbox with cat, I can see that
> something is getting copied to it, but the mail program does not
> recognize any new letters in the destination mailbox. It would seam
> that the "OutFile.write(Message.get_unixfrom())" line is
> essential. However if I run with this line uncommented then I get an
> the following error. "TypeError: argument 1 must be string or
> read-only character buffer, not None". I created this program by
> following an example posted somewhere on the Internet, that I can't
> seam to find anymore. At one time I was able to get Python to put new
> letters in a mailbox.
> 
> Also, I was wondering is there were a way to use Python to delete items
> from a mailbox. I could create I temp box of non-deleted then copy to
> the source box, but that seams messy.

Before writing Python script, perhaps, you should look at 
    man procmailrc
    man formail
and take the relevant process and implement that in Python.

-- 
William Park <opengeometry at yahoo.ca>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
	   http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
	  http://freshmeat.net/projects/bashdiff/



More information about the Python-list mailing list