mbox_stats_via_perl

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



Date: Tue, 3 Oct 2000 16:56:55 -0700
From: Aaron Lehmann <aaronl@vitelus.com>
To: Rick Moen <rick@linuxmafia.com>
Cc: svlug@svlug.org
Subject: Re: [svlug] MUA-hahaha.


--2B/JsCI69OhZNC5r
Content-Type: multipart/mixed; boundary="AhhlLboLdkugWU4S"
Content-Disposition: inline


--AhhlLboLdkugWU4S
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Oct 03, 2000 at 01:54:27AM -0700, Rick Moen wrote:
> begin  Aaron Lehmann quotation:
> =20
> > It would be quite a bit of fun to write an script (awk or perl) to rip
> > through an mbox file and gererate statistics on the MUA's and MTA's
> > that delevered the messages. Thanks for the idea.
>=20
> If you or someone else would set up such a brief report to run,=20
> occasionally, that would be really cool.  It's interesting to see=20
> how many people are using what.

See the attachment. You're welcome to set up a report using the
attached script, although I would recomend that you improve the
formatting of the output (ASCII? HTML? PostScript?) and teach it about
a few popular email clients so that it knows which are free and which
are not.

--AhhlLboLdkugWU4S
Content-Type: application/x-perl
Content-Disposition: attachment; filename="xmailer-stats.pl"
Content-Transfer-Encoding: quoted-printable

#!/usr/bin/perl=0A# xmailer-stats.pl - Reads an mbox file and for each pers=
on, lists an xmailer=0A# Misha Nasledov, Aaron Lehmann=0A=0A# This program =
is free software; you can redistribute it and/or=0A# modify it under the te=
rms of the GNU General Public License=0A# as published by the Free Software=
 Foundation; either version 2=0A# of the License, or (at your option) any l=
ater version.=0A#=0A# This program is distributed in the hope that it will =
be useful,=0A# but WITHOUT ANY WARRANTY; without even the implied warranty =
of=0A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the=0A# GN=
U General Public License for more details.=0A#=0A# You should have received=
 a copy of the GNU General Public License=0A# along with this program; if n=
ot, write to the Free Software=0A# Foundation, Inc., 59 Temple Place - Suit=
e 330, Boston, MA  02111-1307, USA.=0A#=0A# Additionally, you may receive a=
 copy of this license at the following URL:=0A# http://www.gnu.org/copyleft=
/gpl.txt=0A=0Amy $precedence =3D 0; # Set this to 0 if you would like the l=
ast message from=0A                    # a person processed to determine th=
e XMailer that they=0A                    # "use"=0A                    # o=
r set it to 1 for the first one to determine it=0A=0A# --- end of configura=
tion=0A=0Awhile(<STDIN>) {=0A  if(/From /) { # new message, move on...=0A	$=
from =3D 0;=0A	$xmailer =3D 0;=0A  }=0A=0A  elsif(/From: (.*)/) {=0A	if($xm=
ailer) {=0A      if(!$precedence || (!$db{$1})) {=0A		$db{$1} =3D $xmailer;=
=0A	  }=0A	}=0A	else {=0A	  $from =3D $1; #X-Mailer: field has not been spe=
cified yet, wait for it.=0A	}=0A  }=0A  elsif(/^(X-Mailer|User-Agent): (.*)=
/) {=0A	if($from) {=0A	  if(!$precedence || (!$db{$from})) { =0A		$db{$from=
} =3D $2;=0A	  }=0A	}=0A	else {=0A	  $xmailer =3D $2; # From: field has not=
 been specified yet, wait for it.=0A	}=0A  }=0A}=0A=0Aforeach $person (keys=
 %db) {=0A  print "$person: $db{$person}\n";=0A}=0A
--AhhlLboLdkugWU4S--

--2B/JsCI69OhZNC5r
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.3 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE52nJHdtqQf66JWJkRAhE7AJ9huEao8amF5dQV5iJI0XoUFYmTNgCg5vpH
T1L4EbCwS66Ym/pbYvfUu0E=
=GF4A
-----END PGP SIGNATURE-----

the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu