[spambayes-dev] Testing Tools Changes

Tony Meyer ta-meyer at ihug.co.nz
Sun Apr 25 22:52:02 EDT 2004

> > export.py: I added a command-line option to only export
> > messages that were
> > received via a certain account.
> The last change sounds a little nasty, but in general these 
> are tools for us to use to try and perform decent testing for
> Outlook users.  AFAIK, this has never happened :)  Thus,
> anything that may move us in that direction is
> encouraged!


> (You have not referenced a msgstore.py change above though,
> have you?)

No.  For my mail, either it had a "Delivered-To:" header, an "Envelope-To:"
header (with the value being a unique identifier (like
'ta-meyer at pop.ihug.co.nz') for the account), or it was a message that never
left the local Exchange server.  I don't know how true this holds across
other mail servers, though (this is with three different mail servers).  So
I could simply check for those headers, or for the "X-Exchange-Message"

I agree that this sounds a little nasty (and you should see the code
<wink>).  I lean towards not checking it in (anyone interested can hopefully
find this thread in the archives anyway), since I'm not all that sure how
common (given the hypothetical decent testing) needing this (separation by
mail account) would be.

> > msgstore.py (in the Outlook2000 directory): When creating the
> > 'faked up'
> > Exchange headers, I added a "X-Exchange-Delivery-Time"
> > header, which the
> Can you explain that one a little more?  Would it be 
> possible/better to generate the correct Date header?
> (I assume you are saying these messages don't have this header)

Yes, I am saying that (or should have ;).  For example, I get headers like
this (these are all the headers for this particular message - it had no

X-Exchange-Message: true
To: Meyer, Tony
X-Exchange-Delivery-Time: Fri, 23 Apr 2004 15:56:50 +1200

(This obviously includes the one I added).  It probably would be better to
generate the Date header instead (or maybe a Received header?) - I was too
lazy to look up the spec for what one of those would use, so added my own.
A proper Received or Date header would allow any tokenizing options that
work with those headers to use the data, which would be a more beneficial
(assuming those options help!) change.  I could work up a patch that does
this instead, perhaps.

In terms of code, in _GetFakeHeaders, I also retrieved the
PR_MESSAGE_DELIVERY_TIME property, added the appropriate 'delivery_time =
self._GetPotentiallyLarge...' bit and then did:

            from time import timezone
            from email.Utils import formatdate
            headers.append("X-Exchange-Delivery-Time: "+\
                           formatdate(int(delivery_time)-timezone, True))

I formatted the date so that it matched the one that a Received header has,
because this made the change to sort+group.py simpler than leaving it as
Outlook delivered it.

=Tony Meyer

More information about the spambayes-dev mailing list