Email(3)

NAME
Lire::Email - parse and tidy objects commonly found in email logfiles

SYNOPSIS
 use Lire::Email;
 my $parser = new Lire::Email();
 my $log = $parser->parser( $line );
 sanitize('emailadress', $logfrom, $curfrom);
 $tos = sanitize_tos($log->{'to'})
 ($user, $domain) = splitemailadress($address);
 ($stat, $xstat) = splitstat($status);
 my $dlf_maker = $schema->make_hashref2asciidlf_func( qw/time logrelay ...
   stat xstat /);
 $dlflines += print_dlf( $cur, $dlf_maker, \%msg, $to );
See also the sendmail2dlf code for usage.

DESCRIPTION
Lire::Email supplies an object oriented interface to store email logfile lines, similar to the one supplied by Lire::Syslog: it ISA Lire::Syslog.

Furthermore, it supplies routines to manipulate email addresses and status messages, as found in email logfiles.

All dlf convertors generating email dlf should use this module.

All functions will die on error.

  sanitize
sanitize takes three arguments: sanitize(what, it, sane). what is one of 'emailaddress', 'relay', 'relayhost', 'relayip'. 'size', 'stat', 'msgid', 'delay'. it is the current value, in sane the "sanitized" value gets written. E.g. if what is emailadddress and it is 'Joe User <joe@example.com.>', sane gets assigned 'joe@example.com'.

  sanitize_tos
sanitize_tos takes a comma separated list of email addresses as argument. It returns an array of sanitized email addresses.

  splitemailadress
splitemailadress takes a sanitized email address as argument. It returns an array, which contains the userpart and the domainpart as elements.

  splitstat
splitstat takes a sanitized stat, like 'sent_(baa28063_message_accepted_for_delivery)' or 'sent_(ok)' or 'sent_(whew!_done!_was_it_as_good_for_you_as_it_was_for_me?)' or 'queued' as argument. It splits this in the first word and the rest: It returns an array like ('sent', '(ok)').

  splitrelay
splitrelay splits host.example.nl._[100.0.0.45] in host.example.nl. and [100.0.0.45] and splits foo.com[209.54.94.99] in foo.com and [209.54.94.99].

SEE ALSO
Lire::Syslog(3pm), sendmail2dlf(1)

VERSION
$Id: Email.pm,v 1.41 2002/07/04 17:19:47 flacoste Exp $

COPYRIGHT
Copyright (C) 2000-2001 Stichting LogReport Foundation LogReport@LogReport.org

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html or write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.

THANKS
Edward Eldred, for reporting a bug.

AUTHOR
Joost van Baal <joostvb@logreport.org>, based on an idea by Joost Kooij <joost@topaz.mdcc.cx>