Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Mar 2008 12:04:15 -0700
From:      "Patrick C" <pcloches@gmail.com>
To:        "Giorgos Keramidas" <keramida@ceid.upatras.gr>
Cc:        Robert Huff <roberthuff@rcn.com>, questions@freebsd.org
Subject:   Re: Email processing in Python (was: e-mail processing in C)
Message-ID:  <34394a3a0803241204p519b4a03m5ed9d42bd2b98e1b@mail.gmail.com>
In-Reply-To: <874paw3q94.fsf@kobe.laptop>
References:  <18407.62370.787768.503114@jerusalem.litteratus.org> <874paw3q94.fsf@kobe.laptop>

next in thread | previous in thread | raw e-mail | index | archive | help
Searching real quick shows the existence of both libmime and libmbox...
don't know if they're maintained. Another option would be to dig out the
associated code in pine, elm, or whatnot. See how they access mail.

-Patrick

On 24/03/2008, Giorgos Keramidas <keramida@ceid.upatras.gr> wrote:
>
> On Mon, 24 Mar 2008 14:32:02 -0400, Robert Huff <roberthuff@rcn.com>
> wrote:
> > I need to write a quick and not-too-dirty C program to process some
> > e-mail.  (Including dealing with mbox files.)
> >
> > Is there a standard library to do this?  Respectfully,
>
> No, there's no library for `email processing' in the C standard.  You
> can probably find a lot of non-standard ones, by Googling however :)
>
> It's worth writing that plain C is the wrong language for this sort of
> thing, if you ask me.  There are excellent high-level libraries in Perl,
> and Python to do this sort of thing.  Email processing is going to
> require a log of string processing, and C is notoriously 'tricky' for
> this sort of thing.
>
> As an example of the expressiveness of using a higher level language,
> you can display the authors of all the messages in a UNIX mailbox with
> the following short Python script:
>
>     import mailbox
>     m = mailbox.mbox('/home/keramida/mbox')
>     for message in m:
>         author = m['from]
>         print author
>
> This is not just a `readable pseudo-code-like example'.  It's *real*
> Python code, that you can run _now_ in your Python shell.
>
> To perform a similar task in plain C you will need several dozens of
> lines of code, and it won't necessarily be as readable.  It _may_ be
> faster, in some cases, but it will probably won't be as 'safe'.
>
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?34394a3a0803241204p519b4a03m5ed9d42bd2b98e1b>