[Python-bugs-list] [ python-Bugs-412230 ] mailbox.BabylMailbox, missing headers

noreply@sourceforge.net noreply@sourceforge.net
Wed, 11 Apr 2001 13:13:01 -0700


Bugs item #412230, was updated on 2001-03-29 09:06
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=412230&group_id=5470

Category: Documentation
Group: None
>Status: Closed
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Barry Warsaw (bwarsaw)
Summary: mailbox.BabylMailbox, missing headers

Initial Comment:
I am playing around with mailbox.BabylMailbox to parse
my RMAIL
file. It seems like certain headers are only recognized
some of the
time.  For instance, "Message-Id:" headers sometime
appears, sometimes not. 

The following program:

------------------------------------------------------------------
#!/usr/bin/env python
import mailbox
mb = mailbox.BabylMailbox(
open("/home/students/kurlberg/ggg", "r"))
t = mb.next()
print t.headers
print "\nThe message-id is:", t.getheader("Message-ID")
------------------------------------------------------------------

produces:

------------------------------------------------------------------
['X-Sender: clancey@alpha.muga.com\012', 'Date: Wed, 28
Feb 2001 11:41:43 -0500\012', 'To:
faculty@muga.com\012', 'From: Kevin Clancey
<clancey@muga.com>\012', 'Subject: Travel Funds\012',
'Content-Type: text/plain; charset="us-ascii"\012',
'Content-Length: 183\012']

The message-id is: None
------------------------------------------------------------------

The file ggg contains: (I replaced the real domain by
muga.com to
avoid spambots.)

--------- ggg start:
---------------------------------------------
BABYL OPTIONS: -*- rmail -*-
Version: 5
Labels:
Note:   This is the header of an rmail file.
Note:   If you are seeing it in rmail,
Note:    it means the file has no messages in it.
  
1,,
Summary-line: 28-Feb       clancey@muga.com  [23]
#Travel Funds
X-Coding-System: nil
Mail-from: From clancey@muga.com Wed Feb 28 11:50 EST
2001
Received: from clancey.muga.com (clancey
[128.192.3.198])
	by alpha.muga.com (8.9.1/8.9.1) with SMTP id LAA28223
	for <faculty@muga.com>; Wed, 28 Feb 2001 11:48:43
-0500 (EST)
Message-Id:
<3.0.6.32.20010228114143.00921510@alpha.muga.com>
X-Sender: clancey@alpha.muga.com
X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6
(32)
Date: Wed, 28 Feb 2001 11:41:43 -0500
To: faculty@muga.com
From: Kevin Clancey <clancey@muga.com>
Subject: Travel Funds
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Length: 183

*** EOOH ***
X-Sender: clancey@alpha.muga.com
Date: Wed, 28 Feb 2001 11:41:43 -0500
To: faculty@muga.com
From: Kevin Clancey <clancey@muga.com>
Subject: Travel Funds
Content-Type: text/plain; charset="us-ascii"
Content-Length: 183

Please try to submit any travel requests to the
department for travel
during this fiscal year by Friday, March 30, 2001. (FYI
the fiscal
year ends on June 30, 2001.)  Thanks.
-Kevin


 
--------- End of ggg:
-----------------------------------


On the other hand, message-id is found in the following
example:

-------- mail where message-id is
detected---------------

  
0, unseen,,
Summary-line:  4-Aug    root@gauss.muga.com  [18]
#gauss.muga.com 08/04/00:17.01 system check
*** EOOH ***
X-Coding-System: undecided-unix
Mail-from: From root  Fri Aug  4 17:01:01 2000
Return-Path: <root>
Received: (from root@localhost)
	by gauss.muga.com (8.9.3/8.9.3) id RAA13973
	for root; Fri, 4 Aug 2000 17:01:01 -0400
Date: Fri, 4 Aug 2000 17:01:01 -0400
From: root <root@gauss.muga.com>
Message-Id: <200008042101.RAA13973@gauss.muga.com>
To: root@gauss.muga.com
Subject: gauss.muga.com 08/04/00:17.01 system check


Unusual System Events
=-=-=-=-=-=-=-=-=-=-=
Aug  4 16:12:55 gauss sshd[381]: log: Generating new
768 bit RSA key.
Aug  4 16:12:55 gauss sshd[381]: log: RSA key
generation complete.

  
-------- end of mail where message-id is detected
----------


Is there a bug in mailbox/mailbox.BabylMailbox? 

P.S. The above program was run with python version
1.6b1. However,
there are similar problems with python 2.0.

Sorry about the ugly line breaks.

----------------------------------------------------------------------

>Comment By: Barry Warsaw (bwarsaw)
Date: 2001-04-11 13:13

Message:
Logged In: YES 
user_id=12800

Patch checked in for libmailbox.tex 1.18

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-04-11 13:05

Message:
Logged In: YES 
user_id=3066

Documentation patch is accepted; please check in.

----------------------------------------------------------------------

Comment By: Barry Warsaw (bwarsaw)
Date: 2001-04-11 09:20

Message:
Logged In: YES 
user_id=12800

What is actually happening is that the mailbox module is
returning only the headers in the "visible" message, and in
your examples, the Message-ID is only in the original
headers.

Babyl's a weird format in that for each message, you have
all the original headers, which appear before the EOOH line,
and then a subset of those headers, called the "visible"
headers.  This is all the headers that a Babyl compliant
mail reader will show you.

I think it's fine for mailbox to return a mail message
containing only the visible headers.  You'll have to custom
parse a Babyl mailbox file to get at the original headers.

Attached is a suggested change to the mailbox module's
documentation to explain this.  I'm bumping this bug report
over to Fred because it's now a documentation issue, as I
don't believe the mailbox.py module should be changed.

----------------------------------------------------------------------

Comment By: Barry Warsaw (bwarsaw)
Date: 2001-04-11 08:49

Message:
Logged In: YES 
user_id=12800

Ignore this.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=412230&group_id=5470