Mail-Graph
view release on metacpan or search on metacpan
lib/Mail/Graph.pm view on Meta::CPAN
or just plain text. Since the module read in any files that are in one
directory, it can also handle mail-dir style folders, e.g. a directory where
each mail resides in an extra file.
The file format is quite simple and looks like this:
From sample_foo@example.com Tue Oct 27 18:38:52 1998
Received: from barfel by foo.example.com (8.9.1/8.6.12)
From: forged_bar@example.com
X-Envelope-To: <sample_foo@example.com>
Date: Tue, 27 Oct 1998 09:52:14 +0100 (CET)
Message-Id: <199810270852.12345567@example.com>
To: <none@example.com>
Subject: Sorry...
X-Loop-Detect: 1
X-Spamblock: caught by rule dummy@
This is a sample spam
Basically, an email header plus email body, separated by the C<From> lines.
t/testmail.1 view on Meta::CPAN
From sample@forged.com Tue Oct 27 18:38:52 1998
Received: from barfel by foo.example.com (8.9.1/8.6.12) with SMTP id 12345678; Tue, 27 Oct 1998 18:38:51 -0500 (EST)
From: forged@example.com
X-Envelope-To: <sample@example.com>
Date: Tue, 27 Oct 1998 09:52:14 +0100 (CET)
Message-Id: <199810270852.12345567@example.com>
To: <sample@example.com>
Subject: Sorry...
X-Loop-Detect: 1
X-Spamblock: caught by rule dummy@
BODY
This file contains some test spams constructed to test target address
extraction, date comparing/etraction etc.
t/testmail.2 view on Meta::CPAN
From sample@forged.com Tue Oct 27 18:38:52 1998
Received: from barfel by foo.example.com (8.9.1/8.6.12) with SMTP id 12345678 for <sample@example.com>; Tue, 27 Oct 1998 18:38:51 -0500 (EST)
From: forged@example.com
Date: Tue, 27 Oct 1998 09:52:14 +0100 (CET)
Message-Id: <199810270852.12345567@example.com>
To: <wrongsample@example.com>
Subject: Sorry...
X-Envelope-To: <sample@example.com>
X-Loop-Detect: 1
X-Spamblock: caught by rule dummy@
BODY
This message contains Received, so X-Envelope-To is ignored.
t/testmail.3 view on Meta::CPAN
From sample@forged.com Tue Oct 27 18:38:52 1998
Received: from mail.forwarder-example.com by mail.example.com (8.9.1/8.6.12) with SMTP id 12345678 for <sample@example.com>; Tue, 27 Oct 1998 18:38:51 -0500 (EST)
Received: from barfel by mail.forwarder-example.com (8.9.1/8.6.12) with SMTP id 12345678 for <foo@forwarder-example.com>; Tue, 27 Oct 1998 18:38:51 -0500 (EST)
From: forged@example.com
Date: Tue, 27 Oct 1998 09:52:14 +0100 (CET)
Message-Id: <199810270852.12345567@example.com>
X-Envelope-To: <sample@example.com>
To: <sample@example.com>
Subject: Sorry...
X-Loop-Detect: 1
X-Spamblock: caught by rule dummy@
BODY: This message contains a received line by a valid forwarder, so this takes
top priority.
t/testmail.4 view on Meta::CPAN
From sample@example.com Tue Oct 27 18:38:52 1998
Received: from mail.forwarder-example.com by mail.example.com (8.9.1/8.6.12) with SMTP id 12345678 for <anotheruser@example.com>; Tue, 27 Oct 1998 18:38:51 -0500 (EST)
Received: from barfel by mail.invalidforward-example.com (8.9.1/8.6.12) with SMTP id 12345678 for <foo@forwarder-example.com>; Tue, 27 Oct 1998 18:38:51 -0500 (EST)
From: forged@example.com
Date: Tue, 27 Oct 1998 09:52:14 +0100 (CET)
Message-Id: <199810270852.12345567@example.com>
To: <forged@example.com>
Subject: Sorry...
X-Loop-Detect: 1
X-Spamblock: caught by rule dummy@
BODY: This message contains no received line by a valid forwarder, and no
X-Envelope-To, so we use the From: line (before trying anyother received).
SHOULD-BE: 'sample@example.com', 'example.com'
( run in 0.531 second using v1.01-cache-2.11-cpan-49f99fa48dc )