---
name: "Lire::Email"
section: "3pm"
platform: "linux"
package: "lire"
version: "20020214-7"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/Lire::Email"
---

# Lire::Email(3pm)

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

```
 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);
```

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 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 **sanitize**d 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\]. [*Lire::Syslog*(3pm)](/Lire::Syslog/3pm.md) $Id: Email.pm,v 1.34 2002/02/02 11:25:41 vanbaal Exp $ 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. Joost van Baal \<joostvb@logreport.org\>, based on an idea by Joost Kooij \<joost@topaz.mdcc.cx\>
