421 lines
		
	
	
		
			9.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			421 lines
		
	
	
		
			9.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 | 
						|
<html xmlns="http://www.w3.org/1999/xhtml">
 | 
						|
<head>
 | 
						|
<title>GT::Mail::Parse - MIME Parse</title>
 | 
						|
<link rev="made" href="mailto:root@penguin.office.gossamer-threads.com" />
 | 
						|
 | 
						|
<style type="text/css">
 | 
						|
/* $MVD$:fontset("Untitled Font Set 1","ARIEL","HELVETICA","HELV","SANSERIF") */
 | 
						|
/* $MVD$:fontset("Arial","Arial") */
 | 
						|
/* $MVD$:fontset("Arial Black","Arial Black") */
 | 
						|
/* $MVD$:fontset("Algerian","Algerian") */
 | 
						|
 | 
						|
 | 
						|
body {
 | 
						|
    background-color: white;
 | 
						|
    font-family: Verdana, Arial, sans-serif;
 | 
						|
    font-size: small;
 | 
						|
    color: black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
p {
 | 
						|
    background-color : white;
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
h1 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-weight : bold;
 | 
						|
    font-size : medium;
 | 
						|
    background-color : white;
 | 
						|
    color : maroon;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
h2 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : medium;
 | 
						|
    font-weight : bold;
 | 
						|
    color : blue;
 | 
						|
    background-color : white;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
h3 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-weight : bold;
 | 
						|
    font-size : medium;
 | 
						|
    color : black;
 | 
						|
    background-color : white;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
h4 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-weight : bold;
 | 
						|
    font-size : small;
 | 
						|
    color : maroon;
 | 
						|
    background-color : white;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
h5 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-weight : bold;
 | 
						|
    font-size : small;
 | 
						|
    color : blue;
 | 
						|
    background-color : white;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
h6 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-weight : bold;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
    background-color : white;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
ul {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
ol {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
dl {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
li {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
th {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
td {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
dl {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
dd {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
dt {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
code {
 | 
						|
    font-family : Courier;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
pre {
 | 
						|
    font-family : Courier;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
.mvd-H1 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-weight : bold;
 | 
						|
    font-size : 14.0pt;
 | 
						|
    background-color : transparent;
 | 
						|
    background-image : none;
 | 
						|
    color : maroon;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-H2 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : 12.0pt;
 | 
						|
    color : blue;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
p.indent {
 | 
						|
    font-family : "Verdana, Arial, sans-serif";
 | 
						|
    list-style-type : circle;
 | 
						|
    list-style-position : inside;
 | 
						|
    color : black;
 | 
						|
    margin-left : 16.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-P-indent {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    list-style-type : circle;
 | 
						|
    list-style-position : inside;
 | 
						|
    color : black;
 | 
						|
    margin-left : 16.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
pre.programlisting {
 | 
						|
    font-size : 9.0pt;
 | 
						|
    list-style-type : disc;
 | 
						|
    margin-left : 16.0pt;
 | 
						|
    margin-top : -14.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-PRE-programlisting {
 | 
						|
    font-size : 9.0pt;
 | 
						|
    list-style-type : disc;
 | 
						|
    margin-left : 16.0pt;
 | 
						|
    margin-top : -14.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-PRE {
 | 
						|
    font-size : 9.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
p.note {
 | 
						|
    margin-left : 28.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-P-note {
 | 
						|
    margin-left : 28.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-H4 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-weight : normal;
 | 
						|
    font-size : 9.0pt;
 | 
						|
    color : black;
 | 
						|
    margin-left : 6.0pt;
 | 
						|
    margin-top : -14.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-P {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : 10.0pt;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
.mvd-BODY {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    background-color : white;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
p.indentnobullet {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    list-style-type : none;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-P-indentnobullet {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    list-style-type : none;
 | 
						|
}
 | 
						|
</style>
 | 
						|
 | 
						|
 | 
						|
</head>
 | 
						|
 | 
						|
<body style="background-color: white">
 | 
						|
 | 
						|
<p><a name="__index__"></a></p>
 | 
						|
<!-- INDEX BEGIN -->
 | 
						|
 | 
						|
<ul>
 | 
						|
 | 
						|
	<li><a href="#name">NAME</a></li>
 | 
						|
	<li><a href="#synopsis">SYNOPSIS</a></li>
 | 
						|
	<li><a href="#description">DESCRIPTION</a></li>
 | 
						|
	<ul>
 | 
						|
 | 
						|
		<li><a href="#new__constructor_method">new - Constructor method</a></li>
 | 
						|
		<li><a href="#parse__parse_an_email">parse - Parse an email</a></li>
 | 
						|
		<li><a href="#parse_head__parse_just_the_header_of_the_email">parse_head - Parse just the header of the email</a></li>
 | 
						|
		<li><a href="#size__get_the_size">size - Get the size</a></li>
 | 
						|
		<li><a href="#all_parts__get_all_parts">all_parts - Get all parts</a></li>
 | 
						|
	</ul>
 | 
						|
 | 
						|
	<li><a href="#copyright">COPYRIGHT</a></li>
 | 
						|
	<li><a href="#version">VERSION</a></li>
 | 
						|
</ul>
 | 
						|
<!-- INDEX END -->
 | 
						|
 | 
						|
<hr />
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h1><a name="name">NAME</a></h1>
 | 
						|
<p>GT::Mail::Parse - MIME Parse</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<hr />
 | 
						|
<h1><a name="synopsis">SYNOPSIS</a></h1>
 | 
						|
<pre>
 | 
						|
    use GT::Mail::Parse
 | 
						|
    
 | 
						|
    my $parser = new GT::Mail::Parse (
 | 
						|
        naming  => \&name_files,
 | 
						|
        in_file => '/path/to/file.eml',
 | 
						|
        debug   => 1
 | 
						|
    );</pre>
 | 
						|
<pre>
 | 
						|
    my $top = $parser->parse or die $GT::Mail::Parse::error;</pre>
 | 
						|
<pre>
 | 
						|
    - or -</pre>
 | 
						|
<pre>
 | 
						|
    my $parser = new GT::Mail::Parse;
 | 
						|
    
 | 
						|
    open FH, '/path/to/file.eml' or die $!;
 | 
						|
    my $top = $parser->parse (
 | 
						|
        naming  => \&name_files,
 | 
						|
        handle  => \*FH,
 | 
						|
        debug   => 1
 | 
						|
    ) or die $GT::Mail::Parse::error;
 | 
						|
    close FH;</pre>
 | 
						|
<pre>
 | 
						|
    - or -</pre>
 | 
						|
<pre>
 | 
						|
    my $parser = new GT::Mail::Parse;</pre>
 | 
						|
<pre>
 | 
						|
    my $top_head = $parser->parse_head (
 | 
						|
        naming  => \&name_files,
 | 
						|
        in_file => '/path/to/file.eml',
 | 
						|
        debug   => 1
 | 
						|
    ) or die $GT::Mail::Parse::error;</pre>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<hr />
 | 
						|
<h1><a name="description">DESCRIPTION</a></h1>
 | 
						|
<p>GT::Mail::Parse is a 100% rfc822 email MIME parser that supports unlimited 
 | 
						|
nested levels of MIME. Emails are parsed into <a href="glist.cgi?do=admin_gtdoc&topic=/GT/Mail/Parts.html">the GT::Mail::Parts manpage</a> objects. Each 
 | 
						|
part knows where it's body is and each part contains it's sub parts. See
 | 
						|
<a href="glist.cgi?do=admin_gtdoc&topic=/GT/Mail/Parts.html">the GT::Mail::Parts manpage</a> for details on parts methods.</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h2><a name="new__constructor_method">new - Constructor method</a></h2>
 | 
						|
<p>This is the constructor method to get a GT::Mail::Parse object, which you
 | 
						|
need to access all the methods (there are no Class methods). <code>new()</code> takes
 | 
						|
a hash or hash ref as it's arguments. Each key has an accessor method by the
 | 
						|
same name except debug, which can only be set by passing debug to new(), <code>parse()</code>
 | 
						|
or parse_head().</p>
 | 
						|
<dl>
 | 
						|
<dt><strong><a name="item_debug">debug</a></strong><br />
 | 
						|
</dt>
 | 
						|
<dd>
 | 
						|
Sets the debug level for this insance of the class.
 | 
						|
</dd>
 | 
						|
<p></p>
 | 
						|
<dt><strong><a name="item_naming">naming</a></strong><br />
 | 
						|
</dt>
 | 
						|
<dd>
 | 
						|
Specify a code reference to use as a naming convention for each part of the 
 | 
						|
email being parsed. This is useful to keep file IO down when you want the emails
 | 
						|
seperated into each part as a file. If this is not specified GT::Mail::Parse
 | 
						|
uses a default naming, which is to start at one and incriment that number for each
 | 
						|
attachment. The attachments would go in the current working directory.
 | 
						|
</dd>
 | 
						|
<p></p>
 | 
						|
<dt><strong><a name="item_in_file">in_file</a></strong><br />
 | 
						|
</dt>
 | 
						|
<dd>
 | 
						|
Specify the path to the file that contains the email to be parsed. One of in_file
 | 
						|
and handle must be specified.
 | 
						|
</dd>
 | 
						|
<p></p>
 | 
						|
<dt><strong><a name="item_handle">handle</a></strong><br />
 | 
						|
</dt>
 | 
						|
<dd>
 | 
						|
Specify the file handle or IO stream that contains the email to be parsed.
 | 
						|
</dd>
 | 
						|
<p></p></dl>
 | 
						|
<dl>
 | 
						|
<dt><strong><a name="item_attach_rfc822">attach_rfc822</a></strong><br />
 | 
						|
</dt>
 | 
						|
<dd>
 | 
						|
By default, the parser will decode any embeded emails, and flatten out all the 
 | 
						|
parts. If you prefer to leave embeded emails unparsed, pass in 1 to this option
 | 
						|
and the parser will treat it as an attachment.
 | 
						|
</dd>
 | 
						|
<p></p></dl>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h2><a name="parse__parse_an_email">parse - Parse an email</a></h2>
 | 
						|
<p>Instance method. Parses the email specified by either in_file or handle. Returns
 | 
						|
the top level <a href="glist.cgi?do=admin_gtdoc&topic=/GT/Mail/Parts.html">the GT::Mail::Parts manpage</a> object. Any additional parameters passed in are
 | 
						|
treated the same as if they were passed to the constuctor.</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h2><a name="parse_head__parse_just_the_header_of_the_email">parse_head - Parse just the header of the email</a></h2>
 | 
						|
<p>Instance method. This method is exactly the same as parse except only the top
 | 
						|
level header is parsed and it's part object returned. This is useful to keep
 | 
						|
overhead down if you only need to know about the header of the email.</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h2><a name="size__get_the_size">size - Get the size</a></h2>
 | 
						|
<p>Instance method. Returns the total size in bytes of the parsed unencoded email. This 
 | 
						|
method will return undef if no email has been parsed.</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h2><a name="all_parts__get_all_parts">all_parts - Get all parts</a></h2>
 | 
						|
<p>Instance method. Returns all the parts in the parsed email. This is a flatened
 | 
						|
list of the objects. Somewhat similar to what MIME::Tools does. All the parts
 | 
						|
still contain their sub parts.</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<hr />
 | 
						|
<h1><a name="copyright">COPYRIGHT</a></h1>
 | 
						|
<p>Copyright (c) 2004 Gossamer Threads Inc.  All Rights Reserved.
 | 
						|
<a href="http://www.gossamer-threads.com/">http://www.gossamer-threads.com/</a></p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<hr />
 | 
						|
<h1><a name="version">VERSION</a></h1>
 | 
						|
<p>Revision: $Id: Parse.pm,v 1.79 2004/10/23 02:16:39 brewt Exp $</p>
 | 
						|
 | 
						|
</body>
 | 
						|
 | 
						|
</html>
 |