400 lines
		
	
	
		
			8.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			400 lines
		
	
	
		
			8.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::Message - Encapsolates an email message.</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="#creating_a_new_gt__mail__message_object">Creating a new GT::Mail::Message object</a></li>
 | 
						|
		<li><a href="#creating_a_new_part">Creating a new Part</a></li>
 | 
						|
		<li><a href="#manipulating_parts">Manipulating Parts</a></li>
 | 
						|
		<li><a href="#accessing_parts">Accessing 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::Message - Encapsolates an email message.</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<hr />
 | 
						|
<h1><a name="synopsis">SYNOPSIS</a></h1>
 | 
						|
<pre>
 | 
						|
    use GT::Mail::Message;
 | 
						|
 
 | 
						|
    # Get a GT::Mail::Message object from the parser
 | 
						|
    use GT::Mail::Parse;</pre>
 | 
						|
<pre>
 | 
						|
    my $parser = new GT::Mail::Parse( in_file => "myemail.eml" );
 | 
						|
    my $message = $parser->parse;</pre>
 | 
						|
<pre>
 | 
						|
    # Get the top level part
 | 
						|
    my $root_part = $message->root_part;</pre>
 | 
						|
<pre>
 | 
						|
    # Replace the first part with a new part
 | 
						|
    $message->replace_part( $root_part, $message->new_part(
 | 
						|
        to => 'scott@gossamer-threads.com',
 | 
						|
        from => 'alex@gossamer-threads.com',
 | 
						|
        'content-type' => 'text/plain',
 | 
						|
        body_data => 'Hi Scott, how are you?!'
 | 
						|
    );</pre>
 | 
						|
<pre>
 | 
						|
    # Add a part at the end
 | 
						|
    my $end_part = $message->new_part(
 | 
						|
        'content-type' => 'image/gif',
 | 
						|
        body_path      => 'myimage.jpg'
 | 
						|
    );
 | 
						|
    $message->add_part_end( $root_part, $end_part );</pre>
 | 
						|
<pre>
 | 
						|
    # Move the first part in the top part to after the end part
 | 
						|
    $message->move_part_after( $root_part->parts->[0], $end_part );</pre>
 | 
						|
<pre>
 | 
						|
    # Print the mime message
 | 
						|
    print $message->to_string;</pre>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<hr />
 | 
						|
<h1><a name="description">DESCRIPTION</a></h1>
 | 
						|
<p>GT::Mail::Message encapsolates a mime message which consists of 
 | 
						|
<a href="glist.cgi?do=admin_gtdoc&topic=/GT/Mail/Parts.html">the GT::Mail::Parts manpage</a> object. This module provides methods to change,
 | 
						|
move, remove, and access these parts.</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h2><a name="creating_a_new_gt__mail__message_object">Creating a new GT::Mail::Message object</a></h2>
 | 
						|
<p>Usually you will get a GT::Mail::Message object by call the parse method
 | 
						|
in <a href="glist.cgi?do=admin_gtdoc&topic=/GT/Mail/Parse.html">the GT::Mail::Parse manpage</a>.</p>
 | 
						|
<pre>
 | 
						|
    my $message = $parser->parse;</pre>
 | 
						|
<p>You may also call new on this class specifying the top level part and or
 | 
						|
a debug level.</p>
 | 
						|
<pre>
 | 
						|
    my $message = new GT::Mail::Message(
 | 
						|
        root_part => $part,
 | 
						|
        debug    => 1
 | 
						|
    );</pre>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h2><a name="creating_a_new_part">Creating a new Part</a></h2>
 | 
						|
<p>You can create a part by calling new on <a href="glist.cgi?do=admin_gtdoc&topic=/GT/Mail/Parts.html">the GT::Mail::Parts manpage</a> directly</p>
 | 
						|
<pre>
 | 
						|
    my $part = new GT::Mail::Parts;
 | 
						|
    $part->set( 'content-type' => 'image/gif' );
 | 
						|
    $part->body_path( 'myimage.gif' );</pre>
 | 
						|
<p>or you can call a method in this module to get a new part</p>
 | 
						|
<pre>
 | 
						|
    my $part = $message->new_part(
 | 
						|
        'content-type' => 'image/gif',
 | 
						|
        body_path      => 'myimage.gif'
 | 
						|
    );</pre>
 | 
						|
<p>This method is a wraper on a combination of <code>new()</code> and some other
 | 
						|
supporting methods in <a href="glist.cgi?do=admin_gtdoc&topic=/GT/Mail/Parts.html">the GT::Mail::Parts manpage</a> such as body_path(). Anything
 | 
						|
that is not <strong>body_path</strong>, <strong>body_data</strong>, or <strong>body_handle</strong> is treated
 | 
						|
as header values.</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h2><a name="manipulating_parts">Manipulating Parts</a></h2>
 | 
						|
<p>A MIME message is just a format for storing a tree structure. We provide
 | 
						|
tree-like methods to manipulate parts. All the method for manipulating
 | 
						|
parts take the part <code>object(s)</code> as arguments. We do this so you do not need
 | 
						|
to know how the tree is tracked internally.</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h2><a name="accessing_parts">Accessing Parts</a></h2>
 | 
						|
<p>More to come!</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: Message.pm,v 1.14 2004/01/13 01:35:17 jagerman Exp $
 | 
						|
 | 
						|
</p>
 | 
						|
<pre>
 | 
						|
        
 | 
						|
 | 
						|
</pre>
 | 
						|
 | 
						|
</body>
 | 
						|
 | 
						|
</html>
 |