[MANUAL] English:
[zend.git] / documentation / manual / en / module_specs / Zend_Mime_Part.xml
blob2ed2f86f6c75f9432bd97d316d523c0b0b399dfb
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- Reviewed: no -->
3 <sect1 id="zend.mime.part">
4     <title>Zend_Mime_Part</title>
6     <sect2 id="zend.mime.part.introduction">
7         <title>Introduction</title>
9         <para>
10             This class represents a single part of a <acronym>MIME</acronym> message. It contains
11             the actual content of the message part plus information about its encoding,
12             content type and original filename. It provides a method for generating a
13             string from the stored data. <classname>Zend_Mime_Part</classname> objects can be
14             added to <link
15                 linkend="zend.mime.message"><classname>Zend_Mime_Message</classname></link> to
16             assemble a complete multipart message.
17         </para>
18     </sect2>
20     <sect2 id="zend.mime.part.instantiation">
21         <title>Instantiation</title>
23         <para>
24             <classname>Zend_Mime_Part</classname> is instantiated with a string that
25             represents the content of the new part. The type is assumed to be
26             OCTET-STREAM, encoding is 8Bit. After instantiating a
27             <classname>Zend_Mime_Part</classname>, meta information can be set by accessing its
28             attributes directly:
29         </para>
31         <programlisting language="php"><![CDATA[
32 public $type = Zend_Mime::TYPE_OCTETSTREAM;
33 public $encoding = Zend_Mime::ENCODING_8BIT;
34 public $id;
35 public $disposition;
36 public $filename;
37 public $description;
38 public $charset;
39 public $boundary;
40 public $location;
41 public $language;
42 ]]></programlisting>
43     </sect2>
45     <sect2 id="zend.mime.part.methods">
46         <title>Methods for rendering the message part to a string</title>
48         <para>
49             <methodname>getContent()</methodname> returns the encoded content of the
50             MimePart as a string using the encoding specified in the attribute
51             $encoding. Valid values are Zend_Mime::ENCODING_* Characterset conversions are
52             not performed.
53         </para>
55         <para>
56             <methodname>getHeaders()</methodname> returns the Mime-Headers for the
57             MimePart as generated from the information in the publicly accessible
58             attributes. The attributes of the object need to be set correctly before
59             this method is called.
61             <itemizedlist>
62                 <listitem>
63                     <para>
64                         <varname>$charset</varname> has to be set to the actual charset of the
65                         content if it is a text type (Text or HTML).
66                     </para>
67                 </listitem>
68                 <listitem>
69                     <para>
70                         <varname>$id</varname>
71                         may be set to identify a content-id for inline images in a HTML mail.
72                     </para>
73                 </listitem>
74                 <listitem>
75                     <para>
76                         <varname>$filename</varname>
77                         contains the name the file will get when downloading it.
78                     </para>
79                 </listitem>
80                 <listitem>
81                     <para>
82                         <varname>$disposition</varname> defines if the file should be treated as an
83                         attachment or if it is used inside the (HTML-) mail (inline).
84                     </para>
85                 </listitem>
86                 <listitem>
87                     <para>
88                         <varname>$description</varname>
89                         is only used for informational purposes.
90                     </para>
91                 </listitem>
92                 <listitem>
93                     <para>
94                         <varname>$boundary</varname>
95                         defines string as boundary.
96                     </para>
97                 </listitem>
98                 <listitem>
99                     <para>
100                         <varname>$location</varname> can be used as resource <acronym>URI</acronym>
101                         that has relation to the content.
102                     </para>
103                 </listitem>
104                 <listitem>
105                     <para>
106                         <varname>$language</varname>
107                         defines languages in the content.
108                     </para>
109                 </listitem>
110             </itemizedlist>
111         </para>
112     </sect2>
113 </sect1>
114 <!--
115 vim:se ts=4 sw=4 et: