[Tutor] rf1 (fwd)

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Mon, 3 Dec 2001 23:02:47 -0800 (PST)

Hi Kirk,

I'm forwarding your letter to Tutor, so that the others there can give
their input on this.

It sounds like you're looking for the 'rfc822' module, which knows how to
recognize the forms of most mail messages:


rfc822 builds something a bit more complicated than a simple dictionary.

By the way, there's a reason why the admins here won't configure Reply-To
on Tutor... uh... I just can't remember it at the moment.  But thank
goodness for Google.  *grin*

Let's see... ah, there it is!  I do remember that Deirdre was adamantly
against it, and we had a discussion on it way way back in June:


Sorry I didn't respond to your question about reply-to sooner.  But for
the reasons listed on that thread, we won't be munging up messages with
the reply-to header here.

Talk to you later!

---------- Forwarded message ----------
Date: Tue, 04 Dec 2001 01:45:20 -0500
From: Kirk Bailey <deliberatus@my995internet.com>
To: Danny Yoo <dyoo@hkn.eecs.berkeley.edu>
Subject: Re: [Tutor] rf1

Each field in a email has a name at the beginning of it, and that field
ends with the CRLF charpair.

Regretfully, every line in the body also ends with a CRLF, and the body
field does NOT start with a Body: tag. There is simply a blank line
immediately before it- that is, CRLFCRLF(stuff in the body).

I submitted a ciouple of samples of letters Icaptured in the server with
an alias which appends incoming email to an identity to a file, and that
was included.

The idea is to come up with something that wil digest an incoming letter
and be able to pop out data fields on command, such as To, From,
subject, and the all important BODY- which has no name, it just comes
after all the existing headers.

Danny Yoo wrote:
> On Tue, 4 Dec 2001, Kirk Bailey wrote:
> > import string
> >
> > f = open("letter2.TXT",r')
> Be careful --- you need to make sure to balance the quotes, or else Python
> will think that the string is spilling over.  Strings that spill over will
> be flagged as SyntaxErrors in Python, to make sure that you're aware of
> this.
> open(), by the way, will open things with "r"ead permission by default, so
> the following code does the same thing:
>     f = open("letter2.TXT")
> Less typing, and less prone to mistakes.
> > in1=f.readlines()
> > f.close()
> >
> > print in1
> >
> > Looks like it formed a tupple if I grok this right.
> Gotta be nitpicky about this.  *grin* To clarify, the command:
> > in1=f.readlines()
> is giving you back a list of the lines in your file.  There's a difference
> between a tuple and a list.  Tuples use round parentheses:
>    (1, 2, 3)
> and lists use boxy braces:
>    [1, 2, 3]
> They're visually similar, and pretty much serve the same role as a holder
> of possibly many values.  The big difference between tuples and lists,
> though, is that lists are like balloons.  They're inflatable if we use
> append() on them.
> > But I wanted a dictionary! Those are SO much easier to search!
> True: dictionaries are easy to search.  However, we need to tell Python
> how exactly you want to search them.  Can you give a small example on what
> you expect the dictionary to look like?

             -Kirk D Bailey (C)2001
              Addme! icq #27840081

Within the sweep of his sword, Each man is an Ubar.