source: www/manuals/PHP_manual/function.imap-createmailbox.html@ 1

Last change on this file since 1 was 1, checked in by george, 17 years ago

Prvotní import všeho

File size: 5.2 KB
Line 
1<HTML
2><HEAD
3><TITLE
4>imap_createmailbox</TITLE
5><META
6NAME="GENERATOR"
7CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
8REL="HOME"
9TITLE="Manuál PHP"
10HREF="index.html"><LINK
11REL="UP"
12TITLE="IMAP, POP3 and NNTP functions"
13HREF="ref.imap.html"><LINK
14REL="PREVIOUS"
15TITLE="imap_close"
16HREF="function.imap-close.html"><LINK
17REL="NEXT"
18TITLE="imap_delete"
19HREF="function.imap-delete.html"><META
20HTTP-EQUIV="Content-type"
21CONTENT="text/html; charset=ISO-8859-2"></HEAD
22><BODY
23CLASS="refentry"
24BGCOLOR="#FFFFFF"
25TEXT="#000000"
26LINK="#0000FF"
27VLINK="#840084"
28ALINK="#0000FF"
29><DIV
30CLASS="NAVHEADER"
31><TABLE
32SUMMARY="Header navigation table"
33WIDTH="100%"
34BORDER="0"
35CELLPADDING="0"
36CELLSPACING="0"
37><TR
38><TH
39COLSPAN="3"
40ALIGN="center"
41>Manuál PHP</TH
42></TR
43><TR
44><TD
45WIDTH="10%"
46ALIGN="left"
47VALIGN="bottom"
48><A
49HREF="function.imap-close.html"
50ACCESSKEY="P"
51>Pøedcházející</A
52></TD
53><TD
54WIDTH="80%"
55ALIGN="center"
56VALIGN="bottom"
57></TD
58><TD
59WIDTH="10%"
60ALIGN="right"
61VALIGN="bottom"
62><A
63HREF="function.imap-delete.html"
64ACCESSKEY="N"
65>Dal¹í</A
66></TD
67></TR
68></TABLE
69><HR
70ALIGN="LEFT"
71WIDTH="100%"></DIV
72><H1
73><A
74NAME="function.imap-createmailbox"
75></A
76>imap_createmailbox</H1
77><DIV
78CLASS="refnamediv"
79><A
80NAME="AEN33889"
81></A
82><P
83> (PHP 3, PHP 4 )</P
84>imap_createmailbox&nbsp;--&nbsp;Create a new mailbox</DIV
85><DIV
86CLASS="refsect1"
87><A
88NAME="AEN33892"
89></A
90><H2
91>Description</H2
92>bool <B
93CLASS="methodname"
94>imap_createmailbox</B
95> ( resource imap_stream, string mbox)<BR
96></BR
97><P
98>
99 <B
100CLASS="function"
101>imap_createmailbox()</B
102> creates a new mailbox
103 specified by <TT
104CLASS="parameter"
105><I
106>mbox</I
107></TT
108>. Names containing
109 international characters should be encoded by <A
110HREF="function.imap-utf7-encode.html"
111><B
112CLASS="function"
113>imap_utf7_encode()</B
114></A
115>
116 </P
117><P
118>&#13; Returns <TT
119CLASS="constant"
120><B
121>TRUE</B
122></TT
123> on success and <TT
124CLASS="constant"
125><B
126>FALSE</B
127></TT
128> on error.
129 </P
130><P
131>&#13; See also <A
132HREF="function.imap-renamemailbox.html"
133><B
134CLASS="function"
135>imap_renamemailbox()</B
136></A
137>,
138 <A
139HREF="function.imap-deletemailbox.html"
140><B
141CLASS="function"
142>imap_deletemailbox()</B
143></A
144> and
145 <A
146HREF="function.imap-open.html"
147><B
148CLASS="function"
149>imap_open()</B
150></A
151> for the format
152 of <TT
153CLASS="parameter"
154><I
155>mbox</I
156></TT
157> names.
158 </P
159><P
160>
161 <TABLE
162WIDTH="100%"
163BORDER="0"
164CELLPADDING="0"
165CELLSPACING="0"
166CLASS="EXAMPLE"
167><TR
168><TD
169><DIV
170CLASS="example"
171><A
172NAME="AEN33916"
173></A
174><P
175><B
176>Pøíklad 1. <B
177CLASS="function"
178>imap_createmailbox()</B
179> example</B
180></P
181><TABLE
182BORDER="0"
183BGCOLOR="#E0E0E0"
184CELLPADDING="5"
185><TR
186><TD
187><PRE
188CLASS="programlisting"
189>$mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN)
190 or die("can't connect: ".imap_last_error());
191
192$name1 = "phpnewbox";
193$name2 = imap_utf7_encode("phpnewb&#38;ouml;x");
194
195$newname = $name1;
196
197echo "Newname will be '$name1'&#60;br&#62;\n";
198
199# we will now create a new mailbox "phptestbox" in your inbox folder,
200# check its status after creation and finaly remove it to restore
201# your inbox to its initial state
202if(@imap_createmailbox($mbox,imap_utf7_encode("{your.imap.host}INBOX.$newname"))) {
203 $status = @imap_status($mbox,"{your.imap.host}INBOX.$newname",SA_ALL);
204 if($status) {
205 print("your new mailbox '$name1' has the following status:&#60;br&#62;\n");
206 print("Messages: ". $status-&#62;messages )."&#60;br&#62;\n";
207 print("Recent: ". $status-&#62;recent )."&#60;br&#62;\n";
208 print("Unseen: ". $status-&#62;unseen )."&#60;br&#62;\n";
209 print("UIDnext: ". $status-&#62;uidnext )."&#60;br&#62;\n";
210 print("UIDvalidity:". $status-&#62;uidvalidity)."&#60;br&#62;\n";
211
212 if(imap_renamemailbox($mbox,"{your.imap.host}INBOX.$newname","{your.imap.host}INBOX.$name2")) {
213 echo "renamed new mailbox from '$name1' to '$name2'&#60;br&#62;\n";
214 $newname=$name2;
215 } else {
216 print "imap_renamemailbox on new mailbox failed: ".imap_last_error()."&#60;br&#62;\n";
217 }
218 } else {
219 print "imap_status on new mailbox failed: ".imap_last_error()."&#60;br&#62;\n";
220 }
221 if(@imap_deletemailbox($mbox,"{your.imap.host}INBOX.$newname")) {
222 print "new mailbox removed to restore initial state&#60;br&#62;\n";
223 } else {
224 print "imap_deletemailbox on new mailbox failed: ".implode("&#60;br&#62;\n",imap_errors())."&#60;br&#62;\n";
225 }
226
227} else {
228 print "could not create new mailbox: ".implode("&#60;br&#62;\n",imap_errors())."&#60;br&#62;\n";
229}
230
231imap_close($mbox);</PRE
232></TD
233></TR
234></TABLE
235></DIV
236></TD
237></TR
238></TABLE
239>
240 </P
241></DIV
242><DIV
243CLASS="NAVFOOTER"
244><HR
245ALIGN="LEFT"
246WIDTH="100%"><TABLE
247SUMMARY="Footer navigation table"
248WIDTH="100%"
249BORDER="0"
250CELLPADDING="0"
251CELLSPACING="0"
252><TR
253><TD
254WIDTH="33%"
255ALIGN="left"
256VALIGN="top"
257><A
258HREF="function.imap-close.html"
259ACCESSKEY="P"
260>Pøedcházející</A
261></TD
262><TD
263WIDTH="34%"
264ALIGN="center"
265VALIGN="top"
266><A
267HREF="index.html"
268ACCESSKEY="H"
269>Domù</A
270></TD
271><TD
272WIDTH="33%"
273ALIGN="right"
274VALIGN="top"
275><A
276HREF="function.imap-delete.html"
277ACCESSKEY="N"
278>Dal¹í</A
279></TD
280></TR
281><TR
282><TD
283WIDTH="33%"
284ALIGN="left"
285VALIGN="top"
286>imap_close</TD
287><TD
288WIDTH="34%"
289ALIGN="center"
290VALIGN="top"
291><A
292HREF="ref.imap.html"
293ACCESSKEY="U"
294>Nahoru</A
295></TD
296><TD
297WIDTH="33%"
298ALIGN="right"
299VALIGN="top"
300>imap_delete</TD
301></TR
302></TABLE
303></DIV
304></BODY
305></HTML
306>
Note: See TracBrowser for help on using the repository browser.