danbeck Thu Apr 5 17:14:54 2001 EDT Modified files: /phpdoc/en/functions imap.xml Log: rearranged the imap functions to be in alphanumeric order
Index: phpdoc/en/functions/imap.xml diff -u phpdoc/en/functions/imap.xml:1.32 phpdoc/en/functions/imap.xml:1.33 --- phpdoc/en/functions/imap.xml:1.32 Tue Feb 27 17:01:42 2001 +++ phpdoc/en/functions/imap.xml Thu Apr 5 17:14:54 2001 @@ -83,6 +83,63 @@ </para> </partintro> + <refentry id="function.imap-8bit"> + <refnamediv> + <refname>imap_8bit</refname> + <refpurpose> + Convert an 8bit string to a quoted-printable string + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>imap_8bit</function></funcdef> + <paramdef>string <parameter>string</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + Convert an 8bit string to a quoted-printable string (according to + <ulink url="&url.rfc;rfc2045.html">RFC2045</ulink>, section + 6.7). + </para> + <para> + Returns a quoted-printable string. + </para> + <para> + See also <function>imap_qprint</function>. + </para> + </refsect1> + </refentry> + + <refentry id="function.imap-alerts"> + <refnamediv> + <refname>imap_alerts</refname> + <refpurpose> + This function returns all IMAP alert messages (if any) that have + occurred during this page request or since the alert stack was + reset + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>imap_alerts</function></funcdef> + <paramdef>void </paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function returns an array of all of the IMAP alert messages + generated since the last <function>imap_alerts</function> call, + or the beginning of the page. When + <function>imap_alerts</function> is called, the alert stack is + subsequently cleared. The IMAP specification requires that these + messages be passed to the user. + </para> + </refsect1> + </refentry> + <refentry id="function.imap-append"> <refnamediv> <refname>imap_append</refname> @@ -168,6 +225,33 @@ </refsect1> </refentry> + <refentry id="function.imap-binary"> + <refnamediv> + <refname>imap_binary</refname> + <refpurpose> + Convert an 8bit string to a base64 string + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>imap_binary</function></funcdef> + <paramdef>string <parameter>string</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + Convert an 8bit string to a base64 string (according to <ulink + url="&url.rfc;rfc2045.html">RFC2045</ulink>, Section 6.8). + </para> + <para> + Returns a base64 string. + </para> + <para> + See also <function>imap_base64</function>. + </para> + </refsect1> + </refentry> <refentry id="function.imap-body"> <refnamediv> @@ -272,6 +356,45 @@ </refsect1> </refentry> + + <refentry id="function.imap-clearflag-full"> + <refnamediv> + <refname>imap_clearflag_full</refname> + <refpurpose>Clears flags on messages</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>string + <function>imap_clearflag_full</function> + </funcdef> + <paramdef>int <parameter>stream</parameter></paramdef> + <paramdef>string <parameter>sequence</parameter></paramdef> + <paramdef>string <parameter>flag</parameter></paramdef> + <paramdef>string <parameter>options</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function causes a store to delete the specified flag to the + flags set for the messages in the specified sequence. + The flags which you can unset are "\\Seen", "\\Answered", + "\\Flagged", "\\Deleted", "\\Draft", and "\\Recent" (as defined + by RFC2060). + </para> + <para> + The options are a bit mask with one or more of the following: + <informalexample> + <literallayout> +ST_UID The sequence argument contains UIDs instead of + sequence numbers + </literallayout> + </informalexample> + </para> + </refsect1> + </refentry> + + <refentry id="function.imap-close"> <refnamediv> <refname>imap_close</refname> @@ -465,6 +588,34 @@ </refsect1> </refentry> + <refentry id="function.imap-errors"> + <refnamediv> + <refname>imap_errors</refname> + <refpurpose> + This function returns all of the IMAP errors (if any) that have + occurred during this page request or since the error stack was + reset. + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>imap_errors</function></funcdef> + <paramdef>void </paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function returns an array of all of the IMAP error messages + generated since the last <function>imap_errors</function> call, + or the beginning of the page. When + <function>imap_errors</function> is called, the error stack is + subsequently cleared. + </para> + </refsect1> + </refentry> + + <refentry id="function.imap-expunge"> <refnamediv> <refname>imap_expunge</refname> @@ -490,68 +641,233 @@ </refsect1> </refentry> - <refentry id="function.imap-fetchbody"> + <refentry id="function.imap-fetch-overview"> <refnamediv> - <refname>imap_fetchbody</refname> + <refname>imap_fetch_overview</refname> <refpurpose> - Fetch a particular section of the body of the message + Read an overview of the information in the headers of the given message </refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>string <function>imap_fetchbody</function></funcdef> + <funcdef>array <function>imap_fetch_overview</function></funcdef> <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>int <parameter>msg_number</parameter></paramdef> - <paramdef>string <parameter>part_number</parameter></paramdef> - <paramdef>flags - <parameter><optional>flags</optional></parameter> - </paramdef> + <paramdef>string <parameter>sequence</parameter></paramdef> + <paramdef>int <parameter><optional>flags</optional></parameter></paramdef> </funcprototype> </funcsynopsis> - <para> - This function causes a fetch of a particular section of the body - of the specified messages as a text string and returns that text - string. The section specification is a string of integers - delimited by period which index into a body part list as per the - IMAP4 specification. Body parts are not decoded by this function. - </para> <para> - The options for <function>imap_fetchbody</function> is a bitmask - with one or more of the following: + This function fetches mail headers for the given + <parameter>sequence</parameter> and returns an overview of their + contents. <parameter>sequence</parameter> will contain a sequence + of message indices or UIDs, if <parameter>flags</parameter> + contains FT_UID. The returned value is an array of objects + describing one message header each: <itemizedlist> <listitem> <simpara> - FT_UID - The <parameter>msg_number</parameter> is a UID + subject - the messages subject </simpara> </listitem> <listitem> <simpara> - FT_PEEK - Do not set the \Seen flag if not already set + from - who sent it </simpara> </listitem> <listitem> <simpara> - FT_INTERNAL - The return string is in "internal" format, - without any attempt to canonicalize CRLF. + date - when was it sent + </simpara> + </listitem> + <listitem> + <simpara> + message_id - Message-ID + </simpara> + </listitem> + <listitem> + <simpara> + references - is a reference to this message id + </simpara> + </listitem> + <listitem> + <simpara> + size - size in bytes + </simpara> + </listitem> + <listitem> + <simpara> + uid - UID the message has in the mailbox + </simpara> + </listitem> + <listitem> + <simpara> + msgno - message sequence number in the maibox + </simpara> + </listitem> + <listitem> + <simpara> + recent - this message is flagged as recent + </simpara> + </listitem> + <listitem> + <simpara> + flagged - this message is flagged + </simpara> + </listitem> + <listitem> + <simpara> + answered - this message is flagged as answered + </simpara> + </listitem> + <listitem> + <simpara> + deleted - this message is flagged for deletion + </simpara> + </listitem> + <listitem> + <simpara> + seen - this message is flagged as already read + </simpara> + </listitem> + <listitem> + <simpara> + draft - this message is flagged as being a draft </simpara> </listitem> </itemizedlist> </para> - </refsect1> - </refentry> - - <refentry id="function.imap-fetchstructure"> - <refnamediv> - <refname>imap_fetchstructure</refname> - <refpurpose> - Read the structure of a particular message - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> + <para> + <example> + <title><function>imap_fetch_overview</function> example</title> + <programlisting role="php"> +$mbox = imap_open("{your.imap.host:143}","username","password") + || die("can't connect: ".imap_last_error()); + +$overview = imap_fetch_overview($mbox,"2,4:6",0); + +if(is_array($overview)) { + reset($overview); + while( list($key,$val) = each($overview)) { + print $val->msgno + . " - " . $val->date + . " - " . $val->subject + . "\n"; + } +} + +imap_close($mbox); + </programlisting> + </example> + </para> + </refsect1> + </refentry> + + + <refentry id="function.imap-fetchbody"> + <refnamediv> + <refname>imap_fetchbody</refname> + <refpurpose> + Fetch a particular section of the body of the message + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>imap_fetchbody</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + <paramdef>int <parameter>msg_number</parameter></paramdef> + <paramdef>string <parameter>part_number</parameter></paramdef> + <paramdef>flags + <parameter><optional>flags</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function causes a fetch of a particular section of the body + of the specified messages as a text string and returns that text + string. The section specification is a string of integers + delimited by period which index into a body part list as per the + IMAP4 specification. Body parts are not decoded by this function. + </para> + <para> + The options for <function>imap_fetchbody</function> is a bitmask + with one or more of the following: + <itemizedlist> + <listitem> + <simpara> + FT_UID - The <parameter>msg_number</parameter> is a UID + </simpara> + </listitem> + <listitem> + <simpara> + FT_PEEK - Do not set the \Seen flag if not already set + </simpara> + </listitem> + <listitem> + <simpara> + FT_INTERNAL - The return string is in "internal" format, + without any attempt to canonicalize CRLF. + </simpara> + </listitem> + </itemizedlist> + </para> + </refsect1> + </refentry> + + <refentry id="function.imap-fetchheader"> + <refnamediv> + <refname>imap_fetchheader</refname> + <refpurpose>Returns header for a message</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>imap_fetchheader</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + <paramdef>int <parameter>msgno</parameter></paramdef> + <paramdef>int <parameter>flags</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function causes a fetch of the complete, unfiltered + <ulink url="&url.rfc;rfc822.html">RFC822</ulink> + format header of the specified message as a text string and + returns that text string. + </para> + <para> + The options are: + <informalexample> + <literallayout> +FT_UID The msgno argument is a UID +FT_INTERNAL The return string is in "internal" format, + without any attempt to canonicalize to CRLF + newlines +FT_PREFETCHTEXT The RFC822.TEXT should be pre-fetched at the + same time. This avoids an extra RTT on an + IMAP connection if a full message text is + desired (e.g. in a "save to local file" + operation) + </literallayout> + </informalexample> + </para> + </refsect1> + </refentry> + + + <refentry id="function.imap-fetchstructure"> + <refnamediv> + <refname>imap_fetchstructure</refname> + <refpurpose> + Read the structure of a particular message + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> <funcprototype> <funcdef>object <function>imap_fetchstructure</function> @@ -710,234 +1026,60 @@ </refsect1> </refentry> - <refentry id="function.imap-headerinfo"> + <refentry id="function.imap-get-quota"> <refnamediv> - <refname>imap_headerinfo</refname> - <refpurpose>Read the header of the message</refpurpose> + <refname>imap_get_quota</refname> + <refpurpose> + Retrieve the quota level settings, and usage statics per mailbox + </refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> - <funcdef>object <function>imap_headerinfo</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>int <parameter>msg_number</parameter></paramdef> - <paramdef>int - <parameter><optional>fromlength</optional></parameter> - </paramdef> - <paramdef>int - <parameter><optional>subjectlength</optional></parameter> - </paramdef> - <paramdef>string - <parameter><optional>defaulthost</optional></parameter> - </paramdef> + <funcprototype> + <funcdef>array <function>imap_get_quota</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + <paramdef>string <parameter>quota_root</parameter></paramdef> + </funcprototype> </funcsynopsis> <para> - This function returns an object of various header elements. + Returns an array with integer values limit and usage for the given + mailbox. The value of limit represents the total amount of space + allowed for this mailbox. The usage value represents the mailboxes + current level of capacity. Will return FALSE in the case of failure. </para> - <para> - <informalexample> - <literallayout> - remail, date, Date, subject, Subject, in_reply_to, message_id, - newsgroups, followup_to, references - -message flags: - Recent - 'R' if recent and seen, - 'N' if recent and not seen, - ' ' if not recent - Unseen - 'U' if not seen AND not recent, - ' ' if seen OR not seen and recent - Answered -'A' if answered, - ' ' if unanswered - Deleted - 'D' if deleted, - ' ' if not deleted - Draft - 'X' if draft, - ' ' if not draft - Flagged - 'F' if flagged, - ' ' if not flagged - -NOTE that the Recent/Unseen behavior is a little odd. If you want to -know if a message is Unseen, you must check for - -Unseen == 'U' || Recent == 'N' - -toaddress (full to: line, up to 1024 characters) - -to[] (returns an array of objects from the To line, containing): - personal - adl - mailbox - host - -fromaddress (full from: line, up to 1024 characters) - -from[] (returns an array of objects from the From line, containing): - personal - adl - mailbox - host - -ccaddress (full cc: line, up to 1024 characters) -cc[] (returns an array of objects from the Cc line, containing): - personal - adl - mailbox - host - -bccaddress (full bcc line, up to 1024 characters) -bcc[] (returns an array of objects from the Bcc line, containing): - personal - adl - mailbox - host - -reply_toaddress (full reply_to: line, up to 1024 characters) -reply_to[] (returns an array of objects from the Reply_to line, -containing): - personal - adl - mailbox - host - -senderaddress (full sender: line, up to 1024 characters) -sender[] (returns an array of objects from the sender line, containing): - personal - adl - mailbox - host - -return_path (full return-path: line, up to 1024 characters) -return_path[] (returns an array of objects from the return_path line, -containing): - personal - adl - mailbox - host - -udate (mail message date in unix time) - -fetchfrom (from line formatted to fit <parameter>fromlength</parameter> -characters) - -fetchsubject (subject line formatted to fit <parameter>subjectlength</parameter> characters) - </literallayout> - </informalexample> + <para> + This function is currently only available to users of the c-client2000 + library. </para> - </refsect1> - </refentry> - - <refentry id="function.imap-header"> - <refnamediv> - <refname>imap_header</refname> - <refpurpose>Read the header of the message</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcdef>object <function>imap_header</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>int <parameter>msg_number</parameter></paramdef> - <paramdef>int - <parameter><optional>fromlength</optional></parameter> - </paramdef> - <paramdef>int - <parameter><optional>subjectlength</optional></parameter> - </paramdef> - <paramdef>string - <parameter><optional>defaulthost</optional></parameter> - </paramdef> - </funcsynopsis> - <para> - This is an alias to <function>imap_headerinfo</function> - and is identical to this in any way. - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-rfc822-parse-headers"> - <refnamediv> - <refname>imap_rfc822_parse_headers</refname> - <refpurpose>Parse mail headers from a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>object <function>imap_rfc822_parse_headers</function></funcdef> - <paramdef>string <parameter>headers</parameter></paramdef> - <paramdef>string - <parameter><optional>defaulthost</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function returns an object of various header elements, - similar to <function>imap_header</function>, except without the - flags and other elements that come from the IMAP server. - </para> - </refsect1> - </refentry> - -<refentry id="function.imap-headers"> - <refnamediv> - <refname>imap_headers</refname> - <refpurpose> - Returns headers for all messages in a mailbox - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>array <function>imap_headers</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns an array of string formatted with header info. One - element per mail message. - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-listmailbox"> - <refnamediv> - <refname>imap_listmailbox</refname> - <refpurpose>Read the list of mailboxes</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>array <function>imap_listmailbox</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>string <parameter>ref</parameter></paramdef> - <paramdef>string <parameter>pattern</parameter></paramdef> - </funcprototype> - </funcsynopsis> <para> - Returns an array containing the names of the mailboxes. - See <function>imap_getmailboxes</function> for a description - of <parameter>ref</parameter> and <parameter>pattern</parameter>. + <parameter>imap_stream</parameter> should be the value returned from + an <function>imap_status</function> call. This stream is required to + be opened as the mail admin user for the quota function to work. + <parameter>quota_root</parameter> should normally be in the form of + user.name where name is the mailbox you wish to retrieve information + about. </para> <para> <example> - <title><function>imap_listmailbox</function> example</title> + <title><function>imap_get_quota</function> example</title> <programlisting role="php"> -$mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN) +$mbox = imap_open("{your.imap.host}","mailadmin","password",OP_HALFOPEN) || die("can't connect: ".imap_last_error()); -$list = imap_listmailbox($mbox,"{your.imap.host}","*"); -if(is_array($list)) { - reset($list); - while (list($key, $val) = each($list)) - print imap_utf7_decode($val)."<br>\n"; -} else - print "imap_listmailbox failed: ".imap_last_error()."\n"; +$quota_value = imap_get_quota($mbox, "user.kalowsky"); +if(is_array($quota_value)) { + print "Usage level is: " . $quota_value['usage']; + print "Limit level is: " . $quota_value['limit']; +} -imap_close($mbox); +imap_close($mbox); </programlisting> </example> </para> + <para> + See also <function>imap_open</function>, <function>imap_set_quota</function>. + </para> </refsect1> </refentry> @@ -1046,87 +1188,6 @@ </refsect1> </refentry> - <refentry id="function.imap-get-quota"> - <refnamediv> - <refname>imap_get_quota</refname> - <refpurpose> - Retrieve the quota level settings, and usage statics per mailbox - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>array <function>imap_get_quota</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>string <parameter>quota_root</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns an array with integer values limit and usage for the given - mailbox. The value of limit represents the total amount of space - allowed for this mailbox. The usage value represents the mailboxes - current level of capacity. Will return FALSE in the case of failure. - </para> - <para> - This function is currently only available to users of the c-client2000 - library. - </para> - <para> - <parameter>imap_stream</parameter> should be the value returned from - an <function>imap_status</function> call. This stream is required to - be opened as the mail admin user for the quota function to work. - <parameter>quota_root</parameter> should normally be in the form of - user.name where name is the mailbox you wish to retrieve information - about. - </para> - <para> - <example> - <title><function>imap_get_quota</function> example</title> - <programlisting role="php"> -$mbox = imap_open("{your.imap.host}","mailadmin","password",OP_HALFOPEN) - || die("can't connect: ".imap_last_error()); - -$quota_value = imap_get_quota($mbox, "user.kalowsky"); -if(is_array($quota_value)) { - print "Usage level is: " . $quota_value['usage']; - print "Limit level is: " . $quota_value['limit']; -} - -imap_close($mbox); - </programlisting> - </example> - </para> - <para> - See also <function>imap_open</function>, <function>imap_set_quota</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-listsubscribed"> - <refnamediv> - <refname>imap_listsubscribed</refname> - <refpurpose>List all the subscribed mailboxes</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>array <function>imap_listsubscribed</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>string <parameter>ref</parameter></paramdef> - <paramdef>string <parameter>pattern</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns an array of all the mailboxes that you have - subscribed. This is almost identical to - <function>imap_listmailbox</function>, but will only return - mailboxes the user you logged in as has subscribed. - </para> - </refsect1> - </refentry> - <refentry id="function.imap-getsubscribed"> <refnamediv> <refname>imap_getsubscribed</refname> @@ -1150,61 +1211,420 @@ </refsect1> </refentry> - <refentry id="function.imap-mail-copy"> + + <refentry id="function.imap-header"> <refnamediv> - <refname>imap_mail_copy</refname> - <refpurpose>Copy specified messages to a mailbox</refpurpose> + <refname>imap_header</refname> + <refpurpose>Read the header of the message</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> - <funcprototype> - <funcdef>int <function>imap_mail_copy</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>string <parameter>msglist</parameter></paramdef> - <paramdef>string <parameter>mbox</parameter></paramdef> - <paramdef>int - <parameter><optional>flags</optional></parameter> - </paramdef> - </funcprototype> + <funcdef>object <function>imap_header</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + <paramdef>int <parameter>msg_number</parameter></paramdef> + <paramdef>int + <parameter><optional>fromlength</optional></parameter> + </paramdef> + <paramdef>int + <parameter><optional>subjectlength</optional></parameter> + </paramdef> + <paramdef>string + <parameter><optional>defaulthost</optional></parameter> + </paramdef> </funcsynopsis> <para> - Returns true on success and false on error. - </para> - <para> - Copies mail messages specified by <parameter>msglist</parameter> - to specified mailbox. <parameter>msglist</parameter> is a range - not just message numbers (as described in - <ulink url="&url.rfc;rfc2060.html">RFC2060</ulink>). - </para> - <para> - Flags is a bitmask of one or more of - <itemizedlist> - <listitem> - <simpara> - CP_UID - the sequence numbers contain UIDS - </simpara> - </listitem> - <listitem> - <simpara> - CP_MOVE - Delete the messages from the current mailbox after - copying - </simpara> - </listitem> - </itemizedlist> + This is an alias to <function>imap_headerinfo</function> + and is identical to this in any way. </para> </refsect1> </refentry> - <refentry id="function.imap-mail-move"> + <refentry id="function.imap-headerinfo"> <refnamediv> - <refname>imap_mail_move</refname> - <refpurpose>Move specified messages to a mailbox</refpurpose> + <refname>imap_headerinfo</refname> + <refpurpose>Read the header of the message</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> - <funcprototype> + <funcdef>object <function>imap_headerinfo</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + <paramdef>int <parameter>msg_number</parameter></paramdef> + <paramdef>int + <parameter><optional>fromlength</optional></parameter> + </paramdef> + <paramdef>int + <parameter><optional>subjectlength</optional></parameter> + </paramdef> + <paramdef>string + <parameter><optional>defaulthost</optional></parameter> + </paramdef> + </funcsynopsis> + <para> + This function returns an object of various header elements. + </para> + <para> + <informalexample> + <literallayout> + remail, date, Date, subject, Subject, in_reply_to, message_id, + newsgroups, followup_to, references + +message flags: + Recent - 'R' if recent and seen, + 'N' if recent and not seen, + ' ' if not recent + Unseen - 'U' if not seen AND not recent, + ' ' if seen OR not seen and recent + Answered -'A' if answered, + ' ' if unanswered + Deleted - 'D' if deleted, + ' ' if not deleted + Draft - 'X' if draft, + ' ' if not draft + Flagged - 'F' if flagged, + ' ' if not flagged + +NOTE that the Recent/Unseen behavior is a little odd. If you want to +know if a message is Unseen, you must check for + +Unseen == 'U' || Recent == 'N' + +toaddress (full to: line, up to 1024 characters) + +to[] (returns an array of objects from the To line, containing): + personal + adl + mailbox + host + +fromaddress (full from: line, up to 1024 characters) + +from[] (returns an array of objects from the From line, containing): + personal + adl + mailbox + host + +ccaddress (full cc: line, up to 1024 characters) +cc[] (returns an array of objects from the Cc line, containing): + personal + adl + mailbox + host + +bccaddress (full bcc line, up to 1024 characters) +bcc[] (returns an array of objects from the Bcc line, containing): + personal + adl + mailbox + host + +reply_toaddress (full reply_to: line, up to 1024 characters) +reply_to[] (returns an array of objects from the Reply_to line, +containing): + personal + adl + mailbox + host + +senderaddress (full sender: line, up to 1024 characters) +sender[] (returns an array of objects from the sender line, containing): + personal + adl + mailbox + host + +return_path (full return-path: line, up to 1024 characters) +return_path[] (returns an array of objects from the return_path line, +containing): + personal + adl + mailbox + host + +udate (mail message date in unix time) + +fetchfrom (from line formatted to fit <parameter>fromlength</parameter> +characters) + +fetchsubject (subject line formatted to fit <parameter>subjectlength</parameter> +characters) + </literallayout> + </informalexample> + </para> + </refsect1> + </refentry> + + + <refentry id="function.imap-headers"> + <refnamediv> + <refname>imap_headers</refname> + <refpurpose> + Returns headers for all messages in a mailbox + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>imap_headers</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + Returns an array of string formatted with header info. One + element per mail message. + </para> + </refsect1> + </refentry> + + + <refentry id="function.imap-last-error"> + <refnamediv> + <refname>imap_last_error</refname> + <refpurpose> + This function returns the last IMAP error (if any) that occurred + during this page request + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>imap_last_error</function></funcdef> + <paramdef>void </paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function returns the full text of the last IMAP error + message that occurred on the current page. The error stack is + untouched; calling <function>imap_last_error</function> + subsequently, with no intervening errors, will return the same + error. + </para> + </refsect1> + </refentry> + + + <refentry id="function.imap-listmailbox"> + <refnamediv> + <refname>imap_listmailbox</refname> + <refpurpose>Read the list of mailboxes</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>imap_listmailbox</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + <paramdef>string <parameter>ref</parameter></paramdef> + <paramdef>string <parameter>pattern</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + Returns an array containing the names of the mailboxes. + See <function>imap_getmailboxes</function> for a description + of <parameter>ref</parameter> and <parameter>pattern</parameter>. + </para> + <para> + <example> + <title><function>imap_listmailbox</function> example</title> + <programlisting role="php"> +$mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN) + || die("can't connect: ".imap_last_error()); + +$list = imap_listmailbox($mbox,"{your.imap.host}","*"); +if(is_array($list)) { + reset($list); + while (list($key, $val) = each($list)) + print imap_utf7_decode($val)."<br>\n"; +} else + print "imap_listmailbox failed: ".imap_last_error()."\n"; + +imap_close($mbox); + </programlisting> + </example> + </para> + </refsect1> + </refentry> + + + <refentry id="function.imap-listsubscribed"> + <refnamediv> + <refname>imap_listsubscribed</refname> + <refpurpose>List all the subscribed mailboxes</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>imap_listsubscribed</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + <paramdef>string <parameter>ref</parameter></paramdef> + <paramdef>string <parameter>pattern</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + Returns an array of all the mailboxes that you have + subscribed. This is almost identical to + <function>imap_listmailbox</function>, but will only return + mailboxes the user you logged in as has subscribed. + </para> + </refsect1> + </refentry> + + + <refentry id="function.imap-mail"> + <refnamediv> + <refname>imap_mail</refname> + <refpurpose> + Send an email message + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>imap_mail</function></funcdef> + <paramdef>string <parameter>to</parameter></paramdef> + <paramdef>string <parameter>subject</parameter></paramdef> + <paramdef>string <parameter>message</parameter></paramdef> + <paramdef>string + <parameter><optional>additional_headers</optional></parameter> + </paramdef> + <paramdef>string + <parameter><optional>cc</optional></parameter> + </paramdef> + <paramdef>string + <parameter><optional>bcc</optional></parameter> + </paramdef> + <paramdef>string + <parameter><optional>rpath</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function is currently only available in PHP 3. + </para> + </refsect1> + </refentry> + + + <refentry id="function.imap-mail-compose"> + <refnamediv> + <refname>imap_mail_compose</refname> + <refpurpose> + Create a MIME message based on given envelope and body sections + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>imap_mail_compose</function></funcdef> + <paramdef>array <parameter>envelope</parameter></paramdef> + <paramdef>array <parameter>body</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + </para> + <para> + <example> + <title><function>imap_mail_compose</function> example</title> + <programlisting role="php"> +<?php + +$envelope["from"]="[EMAIL PROTECTED]"; +$envelope["to"]="musone@darkstar"; +$envelope["cc"]="[EMAIL PROTECTED]"; + +$part1["type"]=TYPEMULTIPART; +$part1["subtype"]="mixed"; + +$filename="/tmp/imap.c.gz"; +$fp=fopen($filename,"r"); +$contents=fread($fp,filesize($filename)); +fclose($fp); + +$part2["type"]=TYPEAPPLICATION; +$part2["encoding"]=ENCBINARY; +$part2["subtype"]="octet-stream"; +$part2["description"]=basename($filename); +$part2["contents.data"]=$contents; + +$part3["type"]=TYPETEXT; +$part3["subtype"]="plain"; +$part3["description"]="description3"; +$part3["contents.data"]="contents.data3\n\n\n\t"; + +$body[1]=$part1; +$body[2]=$part2; +$body[3]=$part3; + +echo nl2br(imap_mail_compose($envelope,$body)); + +?> + </programlisting> + </example> + </para> + </refsect1> + </refentry> + + <refentry id="function.imap-mail-copy"> + <refnamediv> + <refname>imap_mail_copy</refname> + <refpurpose>Copy specified messages to a mailbox</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imap_mail_copy</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + <paramdef>string <parameter>msglist</parameter></paramdef> + <paramdef>string <parameter>mbox</parameter></paramdef> + <paramdef>int + <parameter><optional>flags</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + Returns true on success and false on error. + </para> + <para> + Copies mail messages specified by <parameter>msglist</parameter> + to specified mailbox. <parameter>msglist</parameter> is a range + not just message numbers (as described in + <ulink url="&url.rfc;rfc2060.html">RFC2060</ulink>). + </para> + <para> + Flags is a bitmask of one or more of + <itemizedlist> + <listitem> + <simpara> + CP_UID - the sequence numbers contain UIDS + </simpara> + </listitem> + <listitem> + <simpara> + CP_MOVE - Delete the messages from the current mailbox after + copying + </simpara> + </listitem> + </itemizedlist> + </para> + </refsect1> + </refentry> + + <refentry id="function.imap-mail-move"> + <refnamediv> + <refname>imap_mail_move</refname> + <refpurpose>Move specified messages to a mailbox</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> <funcdef>int <function>imap_mail_move</function></funcdef> <paramdef>int <parameter>imap_stream</parameter></paramdef> <paramdef>string <parameter>msglist</parameter></paramdef> @@ -1220,22 +1640,192 @@ not just message numbers (as described in <ulink url="&url.rfc;rfc2060.html">RFC2060</ulink>). </para> + <para> + Flags is a bitmask and may contain the single option + <itemizedlist> + <listitem> + <simpara> + CP_UID - the sequence numbers contain UIDS + </simpara> + </listitem> + </itemizedlist> + </para> + <para> + Returns true on success and false on error. + </para> + </refsect1> + </refentry> + + <refentry id="function.imap-mailboxmsginfo"> + <refnamediv> + <refname>imap_mailboxmsginfo</refname> + <refpurpose>Get information about the current mailbox</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>object <function>imap_mailboxmsginfo</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + Returns information about the current mailbox. Returns FALSE on + failure. + </para> + <para> + The <function>imap_mailboxmsginfo</function> function checks the + current mailbox status on the server. It is similar to + <function>imap_status</function>, but will additionally sum up the + size of all messages in the mailbox, which will take some additional + time to execute. It returns the information + in an object with following properties. + </para> + <para> + <table> + <title>Mailbox properties</title> + <tgroup cols="2"> + <tbody> + <row> + <entry>Date</entry> + <entry>date of last change</entry> + </row> + <row> + <entry>Driver</entry> + <entry>driver</entry> + </row> + <row> + <entry>Mailbox</entry> + <entry>name of the mailbox</entry> + </row> + <row> + <entry>Nmsgs</entry> + <entry>number of messages</entry> + </row> + <row> + <entry>Recent</entry> + <entry>number of recent messages</entry> + </row> + <row> + <entry>Unread</entry> + <entry>number of unread messages</entry> + </row> + <row> + <entry>Deleted</entry> + <entry>number of deleted messages</entry> + </row> + <row> + <entry>Size</entry> + <entry>mailbox size</entry> + </row> + </tbody> + </tgroup> + </table> + </para> + <para> + <example> + <title><function>imap_mailboxmsginfo</function> example</title> + <programlisting role="php"> +<?php + +$mbox = imap_open("{your.imap.host}INBOX","username", "password") + || die("can't connect: ".imap_last_error()); + +$check = imap_mailboxmsginfo($mbox); + +if($check) { + print "Date: " . $check->Date ."<br>\n" ; + print "Driver: " . $check->Driver ."<br>\n" ; + print "Mailbox: " . $check->Mailbox ."<br>\n" ; + print "Messages: ". $check->Nmsgs ."<br>\n" ; + print "Recent: " . $check->Recent ."<br>\n" ; + print "Unread: " . $check->Unread ."<br>\n" ; + print "Deleted: " . $check->Deleted ."<br>\n" ; + print "Size: " . $check->Size ."<br>\n" ; +} else { + print "imap_check() failed: ".imap_last_error(). "<br>\n"; +} + +imap_close($mbox); + +?> + </programlisting> + </example> + </para> + </refsect1> + </refentry> + + <refentry id="function.imap-mime-header-decode"> + <refnamediv> + <refname>imap_mime_header_decode</refname> + <refpurpose>Decode MIME header elements</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>imap_header_decode</function></funcdef> + <paramdef>string <parameter>text</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>imap_mime_header_decode</function> function decodes + MIME message header extensions that are non ASCII text + (see <ulink url="&url.rfc;rfc2047.html">RFC2047</ulink>) + The decoded elements are returned in an array of objects, + where each object has two properties, "charset" & "text". + If the element hasn't been encoded, and in other words is in + plain US-ASCII,the "charset" property of that element is set to + "default". + </para> <para> - Flags is a bitmask and may contain the single option - <itemizedlist> - <listitem> - <simpara> - CP_UID - the sequence numbers contain UIDS - </simpara> - </listitem> - </itemizedlist> + <example> + <title><function>imap_mime_header_decode</function> example</title> + <programlisting role="php"> +$text="=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <[EMAIL PROTECTED]>"; + +$elements=imap_mime_header_decode($text); +for($i=0;$i<count($elements);$i++) { + echo "Charset: {$elements[$i]->charset}\n"; + echo "Text: {$elements[$i]->text}\n\n"; +} + + </programlisting> + </example> </para> <para> - Returns true on success and false on error. + In the above example we would have two elements, whereas the first + element had previously been encoded with ISO-8859-1, and the second + element would be plain US-ASCII. + </para> + </refsect1> + </refentry> + + <refentry id="function.imap-msgno"> + <refnamediv> + <refname>imap_msgno</refname> + <refpurpose> + This function returns the message sequence number for the given + UID + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imap_msgno</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + <paramdef>int <parameter>uid</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function returns the message sequence number for the given + UID. It is the inverse of <function>imap_uid</function>. </para> </refsect1> </refentry> + <refentry id="function.imap-num-msg"> <refnamediv> <refname>imap_num_msg</refname> @@ -1355,290 +1945,71 @@ </informalexample> To connect to an NNTP server on port 119 on the local server, use: <informalexample> - <programlisting role="php"> -$nntp = imap_open ("{localhost/nntp:119}comp.test", "", ""); - </programlisting> - </informalexample> - To connect to a remote server replace "localhost" with the name - or the IP address of the server you want to connect to. - </para> - <para> - <example> - <title><function>imap_open</function> example</title> - <programlisting role="php"> -$mbox = imap_open ("{your.imap.host:143}", "username", "password"); - -echo "<p><h1>Mailboxes</h1>\n"; -$folders = imap_listmailbox ($mbox, "{your.imap.host:143}", "*"); - -if ($folders == false) { - echo "Call failed<br>\n"; -} else { - while (list ($key, $val) = each ($folders)) { - echo $val."<br>\n"; - } -} - -echo "<p><h1>Headers in INBOX</h1>\n"; -$headers = imap_headers ($mbox); - -if ($headers == false) { - echo "Call failed<br>\n"; -} else { - while (list ($key,$val) = each ($headers)) { - echo $val."<br>\n"; - } -} - -imap_close($mbox); - </programlisting> - </example> - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-ping"> - <refnamediv> - <refname>imap_ping</refname> - <refpurpose>Check if the IMAP stream is still active</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>imap_ping</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns true if the stream is still alive, false otherwise. - </para> - <para> - <function>imap_ping</function> function pings the stream to see - it is still active. It may discover new mail; this is the - preferred method for a periodic "new mail check" as well as a - "keep alive" for servers which have inactivity timeout. - (As PHP scripts do not tend to run that long, i can hardly - imagine that this function will be usefull to anyone.) - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-renamemailbox"> - <refnamediv> - <refname>imap_renamemailbox</refname> - <refpurpose>Rename an old mailbox to new mailbox</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>imap_renamemailbox</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>string <parameter>old_mbox</parameter></paramdef> - <paramdef>string <parameter>new_mbox</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function renames on old mailbox to new mailbox (see - <function>imap_open</function> for the format of - <parameter>mbox</parameter> names). - </para> - <para> - Returns true on success and false on error. - </para> - <para> - See also <function>imap_createmailbox</function>, - <function>imap_deletemailbox</function>, and - <function>imap_open</function> for the format of - <parameter>mbox</parameter>. - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-reopen"> - <refnamediv> - <refname>imap_reopen</refname> - <refpurpose>Reopen IMAP stream to new mailbox</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>imap_reopen</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>string <parameter>mailbox</parameter></paramdef> - <paramdef>string - <parameter><optional>flags</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function reopens the specified stream to a new mailbox on - an IMAP or NNTP server. - </para> - <para> - The options are a bit mask with one or more of the following: - <itemizedlist> - <listitem> - <simpara> - OP_READONLY - Open mailbox read-only - </simpara> - </listitem> - <listitem> - <simpara> - OP_ANONYMOUS - Dont use or update a - <filename>.newsrc</filename> for news (NNTP only) - </simpara> - </listitem> - <listitem> - <simpara> - OP_HALFOPEN - For IMAP and NNTP names, open a connection but - dont open a mailbox. - </simpara> - </listitem> - <listitem> - <simpara> - CL_EXPUNGE - Expunge mailbox automatically upon mailbox close - (see also <function>imap_delete</function> and - <function>imap_expunge</function>) - </simpara> - </listitem> - </itemizedlist> - </para> - <para> - Returns true on success and false on error. - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-set-quota"> - <refnamediv> - <refname>imap_set_quota</refname> - <refpurpose>Sets a quota for a given mailbox</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>imap_set_quota</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>string <parameter>quota_root</parameter></paramdef> - <paramdef>int <parameter>quota_limit</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Sets an upper limit quota on a per mailbox basis. This function - requires the <parameter>imap_stream</parameter> to have been opened - as the mail administrator account. It will not work if opened as - any other user. - </para> - <para> - This function is currently only available to users of the c-client2000 - library. - </para> - <para> - <parameter>imap_stream</parameter> is the stream pointer returned from - a <function>imap_open</function> call. This stream must be opened as - the mail administrator, other wise this function will fail. - <parameter>quota_root</parameter> is the mailbox to have a quota set. This - should follow the IMAP standard format for a mailbox, 'user.name'. - <parameter>quota_limit</parameter> is the maximum size (in KB) for - the <parameter>quota_root</parameter>. - </para> - <para> - Returns true on success and false on error. + <programlisting role="php"> +$nntp = imap_open ("{localhost/nntp:119}comp.test", "", ""); + </programlisting> + </informalexample> + To connect to a remote server replace "localhost" with the name + or the IP address of the server you want to connect to. </para> <para> <example> - <title><function>imap_set_quota</function> example</title> + <title><function>imap_open</function> example</title> <programlisting role="php"> -$mbox = imap_open ("{your.imap.host:143}", "mailadmin", "password"); +$mbox = imap_open ("{your.imap.host:143}", "username", "password"); -if(!imap_set_quota($mbox, "user.kalowsky", 3000)) { - print "Error in setting quota\n"; - return; +echo "<p><h1>Mailboxes</h1>\n"; +$folders = imap_listmailbox ($mbox, "{your.imap.host:143}", "*"); + +if ($folders == false) { + echo "Call failed<br>\n"; +} else { + while (list ($key, $val) = each ($folders)) { + echo $val."<br>\n"; + } +} + +echo "<p><h1>Headers in INBOX</h1>\n"; +$headers = imap_headers ($mbox); + +if ($headers == false) { + echo "Call failed<br>\n"; +} else { + while (list ($key,$val) = each ($headers)) { + echo $val."<br>\n"; + } } imap_close($mbox); </programlisting> </example> </para> - <para> - See also <function>imap_open</function>, <function>imap_set_quota</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-subscribe"> - <refnamediv> - <refname>imap_subscribe</refname> - <refpurpose>Subscribe to a mailbox</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>imap_subscribe</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>string <parameter>mbox</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Subscribe to a new mailbox. - </para> - <para> - Returns true on success and false on error. - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-undelete"> - <refnamediv> - <refname>imap_undelete</refname> - <refpurpose> - Unmark the message which is marked deleted - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>imap_undelete</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>int <parameter>msg_number</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function removes the deletion flag for a specified message, - which is set by <function>imap_delete</function> or - <function>imap_mail_move</function>. - </para> - <para> - Returns true on success and false on error. - </para> </refsect1> </refentry> - <refentry id="function.imap-unsubscribe"> + <refentry id="function.imap-ping"> <refnamediv> - <refname>imap_unsubscribe</refname> - <refpurpose>Unsubscribe from a mailbox</refpurpose> + <refname>imap_ping</refname> + <refpurpose>Check if the IMAP stream is still active</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>imap_unsubscribe</function></funcdef> + <funcdef>int <function>imap_ping</function></funcdef> <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>string <parameter>mbox</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - Unsubscribe from a specified mailbox. + Returns true if the stream is still alive, false otherwise. </para> <para> - Returns true on success and false on error. + <function>imap_ping</function> function pings the stream to see + it is still active. It may discover new mail; this is the + preferred method for a periodic "new mail check" as well as a + "keep alive" for servers which have inactivity timeout. + (As PHP scripts do not tend to run that long, i can hardly + imagine that this function will be usefull to anyone.) </para> </refsect1> </refentry> @@ -1671,225 +2042,91 @@ </refsect1> </refentry> - <refentry id="function.imap-8bit"> - <refnamediv> - <refname>imap_8bit</refname> - <refpurpose> - Convert an 8bit string to a quoted-printable string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>imap_8bit</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Convert an 8bit string to a quoted-printable string (according to - <ulink url="&url.rfc;rfc2045.html">RFC2045</ulink>, section - 6.7). - </para> - <para> - Returns a quoted-printable string. - </para> - <para> - See also <function>imap_qprint</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-binary"> - <refnamediv> - <refname>imap_binary</refname> - <refpurpose> - Convert an 8bit string to a base64 string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>imap_binary</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Convert an 8bit string to a base64 string (according to <ulink - url="&url.rfc;rfc2045.html">RFC2045</ulink>, Section 6.8). - </para> - <para> - Returns a base64 string. - </para> - <para> - See also <function>imap_base64</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-scanmailbox"> - <refnamediv> - <refname>imap_scanmailbox</refname> - <refpurpose> - Read the list of mailboxes, takes a string to search for in the - text of the mailbox - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>array <function>imap_scanmailbox</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>string <parameter>ref</parameter></paramdef> - <paramdef>string <parameter>pattern</parameter></paramdef> - <paramdef>string <parameter>content</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns an array containing the names of the mailboxes that have - <parameter>string</parameter> in the text of the mailbox. - This function is similar to <function>imap_listmailbox</function>, - but it will additionally check for the presence of the string - <parameter>content</parameter> inside the mailbox data. - See <function>imap_getmailboxes</function> for a description - of <parameter>ref</parameter> and <parameter>pattern</parameter>. - </para> - </refsect1> - </refentry> - <refentry id="function.imap-mailboxmsginfo"> + <refentry id="function.imap-renamemailbox"> <refnamediv> - <refname>imap_mailboxmsginfo</refname> - <refpurpose>Get information about the current mailbox</refpurpose> + <refname>imap_renamemailbox</refname> + <refpurpose>Rename an old mailbox to new mailbox</refpurpose> </refnamediv> <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>object <function>imap_mailboxmsginfo</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns information about the current mailbox. Returns FALSE on - failure. - </para> - <para> - The <function>imap_mailboxmsginfo</function> function checks the - current mailbox status on the server. It is similar to - <function>imap_status</function>, but will additionally sum up the - size of all messages in the mailbox, which will take some additional - time to execute. It returns the information - in an object with following properties. - </para> - <para> - <table> - <title>Mailbox properties</title> - <tgroup cols="2"> - <tbody> - <row> - <entry>Date</entry> - <entry>date of last change</entry> - </row> - <row> - <entry>Driver</entry> - <entry>driver</entry> - </row> - <row> - <entry>Mailbox</entry> - <entry>name of the mailbox</entry> - </row> - <row> - <entry>Nmsgs</entry> - <entry>number of messages</entry> - </row> - <row> - <entry>Recent</entry> - <entry>number of recent messages</entry> - </row> - <row> - <entry>Unread</entry> - <entry>number of unread messages</entry> - </row> - <row> - <entry>Deleted</entry> - <entry>number of deleted messages</entry> - </row> - <row> - <entry>Size</entry> - <entry>mailbox size</entry> - </row> - </tbody> - </tgroup> - </table> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imap_renamemailbox</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + <paramdef>string <parameter>old_mbox</parameter></paramdef> + <paramdef>string <parameter>new_mbox</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function renames on old mailbox to new mailbox (see + <function>imap_open</function> for the format of + <parameter>mbox</parameter> names). </para> <para> - <example> - <title><function>imap_mailboxmsginfo</function> example</title> - <programlisting role="php"> -<?php - -$mbox = imap_open("{your.imap.host}INBOX","username", "password") - || die("can't connect: ".imap_last_error()); - -$check = imap_mailboxmsginfo($mbox); - -if($check) { - print "Date: " . $check->Date ."<br>\n" ; - print "Driver: " . $check->Driver ."<br>\n" ; - print "Mailbox: " . $check->Mailbox ."<br>\n" ; - print "Messages: ". $check->Nmsgs ."<br>\n" ; - print "Recent: " . $check->Recent ."<br>\n" ; - print "Unread: " . $check->Unread ."<br>\n" ; - print "Deleted: " . $check->Deleted ."<br>\n" ; - print "Size: " . $check->Size ."<br>\n" ; -} else { - print "imap_check() failed: ".imap_last_error(). "<br>\n"; -} - -imap_close($mbox); - -?> - </programlisting> - </example> + Returns true on success and false on error. + </para> + <para> + See also <function>imap_createmailbox</function>, + <function>imap_deletemailbox</function>, and + <function>imap_open</function> for the format of + <parameter>mbox</parameter>. </para> </refsect1> </refentry> - <refentry id="function.imap-rfc822-write-address"> + <refentry id="function.imap-reopen"> <refnamediv> - <refname>imap_rfc822_write_address</refname> - <refpurpose> - Returns a properly formatted email address given the mailbox, - host, and personal info. - </refpurpose> + <refname>imap_reopen</refname> + <refpurpose>Reopen IMAP stream to new mailbox</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>string - <function>imap_rfc822_write_address</function> - </funcdef> + <funcdef>int <function>imap_reopen</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> <paramdef>string <parameter>mailbox</parameter></paramdef> - <paramdef>string <parameter>host</parameter></paramdef> - <paramdef>string <parameter>personal</parameter></paramdef> + <paramdef>string + <parameter><optional>flags</optional></parameter> + </paramdef> </funcprototype> </funcsynopsis> - <para> - Returns a properly formatted email address as defined in - <ulink url="&url.rfc;rfc822.html">RFC822</ulink> - given the mailbox, host, and personal info. + <para> + This function reopens the specified stream to a new mailbox on + an IMAP or NNTP server. </para> <para> - <example> - <title><function>imap_rfc822_write_address</function> example</title> - <programlisting role="php"> -print imap_rfc822_write_address("hartmut","cvs.php.net","Hartmut Holzgraefe")."\n"; - </programlisting> - </example> + The options are a bit mask with one or more of the following: + <itemizedlist> + <listitem> + <simpara> + OP_READONLY - Open mailbox read-only + </simpara> + </listitem> + <listitem> + <simpara> + OP_ANONYMOUS - Dont use or update a + <filename>.newsrc</filename> for news (NNTP only) + </simpara> + </listitem> + <listitem> + <simpara> + OP_HALFOPEN - For IMAP and NNTP names, open a connection but + dont open a mailbox. + </simpara> + </listitem> + <listitem> + <simpara> + CL_EXPUNGE - Expunge mailbox automatically upon mailbox close + (see also <function>imap_delete</function> and + <function>imap_expunge</function>) + </simpara> + </listitem> + </itemizedlist> + </para> + <para> + Returns true on success and false on error. </para> </refsect1> </refentry> @@ -1947,246 +2184,107 @@ $address_string = "Hartmut Holzgraefe <[EMAIL PROTECTED]>, [EMAIL PROTECTED], root"; $address_array = imap_rfc822_parse_adrlist($address_string,"somedomain.net"); if(! is_array($address_array)) die("somethings wrong\n"); - -reset($address_array); -while(list($key,$val)=each($address_array)){ - print "mailbox : ".$val->mailbox."<br>\n"; - print "host : ".$val->host."<br>\n"; - print "personal: ".$val->personal."<br>\n"; - print "adl : ".$val->adl."<p>\n"; -} - </programlisting> - </example> - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-setflag-full"> - <refnamediv> - <refname>imap_setflag_full</refname> - <refpurpose>Sets flags on messages</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>imap_setflag_full</function></funcdef> - <paramdef>int <parameter>stream</parameter></paramdef> - <paramdef>string <parameter>sequence</parameter></paramdef> - <paramdef>string <parameter>flag</parameter></paramdef> - <paramdef>string <parameter>options</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function causes a store to add the specified flag to the - flags set for the messages in the specified sequence. - </para> - <para> - The flags which you can set are "\\Seen", "\\Answered", - "\\Flagged", "\\Deleted", "\\Draft", and "\\Recent" (as defined - by RFC2060). - </para> - <para> - The options are a bit mask with one or more of the following: - <informalexample> - <literallayout> -ST_UID The sequence argument contains UIDs instead of - sequence numbers - </literallayout> - </informalexample> - </para> - <para> - <example> - <title><function>imap_setflag_full</function> example</title> - <programlisting role="php"> -$mbox = imap_open("{your.imap.host:143}","username","password") - || die("can't connect: ".imap_last_error()); - -$status = imap_setflag_full($mbox,"2,5","\\Seen \\Flagged"); - -print gettype($status)."\n"; -print $status."\n"; -imap_close($mbox); - </programlisting> - </example> - </para> </refsect1> - </refentry> - - <refentry id="function.imap-clearflag-full"> - <refnamediv> - <refname>imap_clearflag_full</refname> - <refpurpose>Clears flags on messages</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string - <function>imap_clearflag_full</function> - </funcdef> - <paramdef>int <parameter>stream</parameter></paramdef> - <paramdef>string <parameter>sequence</parameter></paramdef> - <paramdef>string <parameter>flag</parameter></paramdef> - <paramdef>string <parameter>options</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function causes a store to delete the specified flag to the - flags set for the messages in the specified sequence. - The flags which you can unset are "\\Seen", "\\Answered", - "\\Flagged", "\\Deleted", "\\Draft", and "\\Recent" (as defined - by RFC2060). - </para> - <para> - The options are a bit mask with one or more of the following: - <informalexample> - <literallayout> -ST_UID The sequence argument contains UIDs instead of - sequence numbers - </literallayout> - </informalexample> - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-sort"> - <refnamediv> - <refname>imap_sort</refname> - <refpurpose>Sort an array of message headers</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>array <function>imap_sort</function></funcdef> - <paramdef>int <parameter>stream</parameter></paramdef> - <paramdef>int <parameter>criteria</parameter></paramdef> - <paramdef>int <parameter>reverse</parameter></paramdef> - <paramdef>int <parameter>options</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns an array of message numbers sorted by the given - parameters. - </para> - <para> - <parameter>Reverse</parameter> is 1 for reverse-sorting. - </para> - <para> - Criteria can be one (and only one) of the following: - <informalexample> - <literallayout> -SORTDATE message Date -SORTARRIVAL arrival date -SORTFROM mailbox in first From address -SORTSUBJECT message Subject -SORTTO mailbox in first To address -SORTCC mailbox in first cc address -SORTSIZE size of message in octets - </literallayout> - </informalexample> - </para> - <para> - The flags are a bitmask of one or more of the following: - <informalexample> - <literallayout> -SE_UID Return UIDs instead of sequence numbers -SE_NOPREFETCH Don't prefetch searched messages. - </literallayout> - </informalexample> +reset($address_array); +while(list($key,$val)=each($address_array)){ + print "mailbox : ".$val->mailbox."<br>\n"; + print "host : ".$val->host."<br>\n"; + print "personal: ".$val->personal."<br>\n"; + print "adl : ".$val->adl."<p>\n"; +} + </programlisting> + </example> </para> </refsect1> </refentry> - <refentry id="function.imap-fetchheader"> + <refentry id="function.imap-rfc822-parse-headers"> <refnamediv> - <refname>imap_fetchheader</refname> - <refpurpose>Returns header for a message</refpurpose> + <refname>imap_rfc822_parse_headers</refname> + <refpurpose>Parse mail headers from a string</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>string <function>imap_fetchheader</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>int <parameter>msgno</parameter></paramdef> - <paramdef>int <parameter>flags</parameter></paramdef> + <funcdef>object <function>imap_rfc822_parse_headers</function></funcdef> + <paramdef>string <parameter>headers</parameter></paramdef> + <paramdef>string + <parameter><optional>defaulthost</optional></parameter> + </paramdef> </funcprototype> </funcsynopsis> <para> - This function causes a fetch of the complete, unfiltered - <ulink url="&url.rfc;rfc822.html">RFC822</ulink> - format header of the specified message as a text string and - returns that text string. - </para> - <para> - The options are: - <informalexample> - <literallayout> -FT_UID The msgno argument is a UID -FT_INTERNAL The return string is in "internal" format, - without any attempt to canonicalize to CRLF - newlines -FT_PREFETCHTEXT The RFC822.TEXT should be pre-fetched at the - same time. This avoids an extra RTT on an - IMAP connection if a full message text is - desired (e.g. in a "save to local file" - operation) - </literallayout> - </informalexample> + This function returns an object of various header elements, + similar to <function>imap_header</function>, except without the + flags and other elements that come from the IMAP server. </para> </refsect1> </refentry> - <refentry id="function.imap-uid"> + <refentry id="function.imap-rfc822-write-address"> <refnamediv> - <refname>imap_uid</refname> + <refname>imap_rfc822_write_address</refname> <refpurpose> - This function returns the UID for the given message sequence - number + Returns a properly formatted email address given the mailbox, + host, and personal info. </refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>imap_uid</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>int <parameter>msgno</parameter></paramdef> + <funcdef>string + <function>imap_rfc822_write_address</function> + </funcdef> + <paramdef>string <parameter>mailbox</parameter></paramdef> + <paramdef>string <parameter>host</parameter></paramdef> + <paramdef>string <parameter>personal</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - This function returns the UID for the given message sequence - number. An UID is an unique identifier that will not change over - time while a message sequence number may change whenever the - content of the mailbox changes. This function is the inverse of - <function>imap_msgno</function>. + Returns a properly formatted email address as defined in + <ulink url="&url.rfc;rfc822.html">RFC822</ulink> + given the mailbox, host, and personal info. + </para> + <para> + <example> + <title><function>imap_rfc822_write_address</function> example</title> + <programlisting role="php"> +print imap_rfc822_write_address("hartmut","cvs.php.net","Hartmut Holzgraefe")."\n"; + + </programlisting> + </example> </para> </refsect1> </refentry> - - <refentry id="function.imap-msgno"> + <refentry id="function.imap-scanmailbox"> <refnamediv> - <refname>imap_msgno</refname> + <refname>imap_scanmailbox</refname> <refpurpose> - This function returns the message sequence number for the given - UID + Read the list of mailboxes, takes a string to search for in the + text of the mailbox </refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>imap_msgno</function></funcdef> + <funcdef>array <function>imap_scanmailbox</function></funcdef> <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>int <parameter>uid</parameter></paramdef> + <paramdef>string <parameter>ref</parameter></paramdef> + <paramdef>string <parameter>pattern</parameter></paramdef> + <paramdef>string <parameter>content</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - This function returns the message sequence number for the given - UID. It is the inverse of <function>imap_uid</function>. + Returns an array containing the names of the mailboxes that have + <parameter>string</parameter> in the text of the mailbox. + This function is similar to <function>imap_listmailbox</function>, + but it will additionally check for the presence of the string + <parameter>content</parameter> inside the mailbox data. + See <function>imap_getmailboxes</function> for a description + of <parameter>ref</parameter> and <parameter>pattern</parameter>. </para> </refsect1> </refentry> @@ -2345,381 +2443,255 @@ use: "UNANSWERED FROM mom". Searches appear to be case insensitive. This list of criteria is from a reading of the UW c-client source code and may be uncomplete or - inaccurate (see also RFC2060, section 6.4.4). - </para> - <para> - Valid values for flags are SE_UID, which causes the returned - array to contain UIDs instead of messages sequence numbers. - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-last-error"> - <refnamediv> - <refname>imap_last_error</refname> - <refpurpose> - This function returns the last IMAP error (if any) that occurred - during this page request - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>imap_last_error</function></funcdef> - <paramdef>void </paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function returns the full text of the last IMAP error - message that occurred on the current page. The error stack is - untouched; calling <function>imap_last_error</function> - subsequently, with no intervening errors, will return the same - error. - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-errors"> - <refnamediv> - <refname>imap_errors</refname> - <refpurpose> - This function returns all of the IMAP errors (if any) that have - occurred during this page request or since the error stack was - reset. - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>array <function>imap_errors</function></funcdef> - <paramdef>void </paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function returns an array of all of the IMAP error messages - generated since the last <function>imap_errors</function> call, - or the beginning of the page. When - <function>imap_errors</function> is called, the error stack is - subsequently cleared. - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-alerts"> - <refnamediv> - <refname>imap_alerts</refname> - <refpurpose> - This function returns all IMAP alert messages (if any) that have - occurred during this page request or since the alert stack was - reset - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>array <function>imap_alerts</function></funcdef> - <paramdef>void </paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function returns an array of all of the IMAP alert messages - generated since the last <function>imap_alerts</function> call, - or the beginning of the page. When - <function>imap_alerts</function> is called, the alert stack is - subsequently cleared. The IMAP specification requires that these - messages be passed to the user. - </para> - </refsect1> - </refentry> - - <refentry id="function.imap-status"> - <refnamediv> - <refname>imap_status</refname> - <refpurpose> - This function returns status information on a mailbox other than - the current one - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>object <function>imap_status</function></funcdef> - <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>string <parameter>mailbox</parameter></paramdef> - <paramdef>int <parameter>options</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function returns an object containing status - information. Valid flags are: - <itemizedlist> - <listitem> - <simpara> - SA_MESSAGES - set status->messages to the number of messages - in the mailbox - </simpara> - </listitem> - <listitem> - <simpara> - SA_RECENT - set status->recent to the number of recent - messages in the mailbox - </simpara> - </listitem> - <listitem> - <simpara> - SA_UNSEEN - set status->unseen to the number of unseen (new) - messages in the mailbox - </simpara> - </listitem> - <listitem> - <simpara> - SA_UIDNEXT - set status->uidnext to the next uid to be used in - the mailbox - </simpara> - </listitem> - <listitem> - <simpara> - SA_UIDVALIDITY - set status->uidvalidity to a constant that - changes when uids for the mailbox may no longer be valid - </simpara> - </listitem> - <listitem> - <simpara> - SA_ALL - set all of the above - </simpara> - </listitem> - </itemizedlist> - </para> - <para> - status->flags is also set, which contains a bitmask which can be - checked against any of the above constants. + inaccurate (see also RFC2060, section 6.4.4). </para> <para> - <example> - <title><function>imap_status</function> example</title> - <programlisting role="php"> -$mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN) - || die("can't connect: ".imap_last_error()); - -$status = imap_status($mbox,"{your.imap.host}INBOX",SA_ALL); -if($status) { - print("Messages: ". $status->messages )."<br>\n"; - print("Recent: ". $status->recent )."<br>\n"; - print("Unseen: ". $status->unseen )."<br>\n"; - print("UIDnext: ". $status->uidnext )."<br>\n"; - print("UIDvalidity:". $status->uidvalidity)."<br>\n"; -} else - print "imap_status failed: ".imap_lasterror()."\n"; - -imap_close($mbox); - </programlisting> - </example> + Valid values for flags are SE_UID, which causes the returned + array to contain UIDs instead of messages sequence numbers. </para> </refsect1> </refentry> - <refentry id="function.imap-utf7-decode"> + <refentry id="function.imap-set-quota"> <refnamediv> - <refname>imap_utf7_decode</refname> - <refpurpose> - Decodes a modified UTF-7 encoded string. - </refpurpose> + <refname>imap_set_quota</refname> + <refpurpose>Sets a quota for a given mailbox</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>string <function>imap_utf7_decode</function></funcdef> - <paramdef>string <parameter>text</parameter></paramdef> + <funcdef>int <function>imap_set_quota</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + <paramdef>string <parameter>quota_root</parameter></paramdef> + <paramdef>int <parameter>quota_limit</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - Decodes modified UTF-7 <parameter>text</parameter> into 8bit data. + Sets an upper limit quota on a per mailbox basis. This function + requires the <parameter>imap_stream</parameter> to have been opened + as the mail administrator account. It will not work if opened as + any other user. </para> <para> - Returns the decoded 8bit data, or false if the input string was - not valid modified UTF-7. This function is needed to decode - mailbox names that contain international characters outside of - the printable ASCII range. The modified UTF-7 encoding is defined - in <ulink url="&url.rfc;rfc2060.html">RFC 2060</ulink>, section - 5.1.3 (original UTF-7 was defned in <ulink - url="&url.rfc;rfc1642.html">RFC1642</ulink>). + This function is currently only available to users of the c-client2000 + library. + </para> + <para> + <parameter>imap_stream</parameter> is the stream pointer returned from + a <function>imap_open</function> call. This stream must be opened as + the mail administrator, other wise this function will fail. + <parameter>quota_root</parameter> is the mailbox to have a quota set. This + should follow the IMAP standard format for a mailbox, 'user.name'. + <parameter>quota_limit</parameter> is the maximum size (in KB) for + the <parameter>quota_root</parameter>. + </para> + <para> + Returns true on success and false on error. + </para> + <para> + <example> + <title><function>imap_set_quota</function> example</title> + <programlisting role="php"> +$mbox = imap_open ("{your.imap.host:143}", "mailadmin", "password"); + +if(!imap_set_quota($mbox, "user.kalowsky", 3000)) { + print "Error in setting quota\n"; + return; +} + +imap_close($mbox); + </programlisting> + </example> + </para> + <para> + See also <function>imap_open</function>, <function>imap_set_quota</function>. </para> </refsect1> </refentry> - <refentry id="function.imap-utf7-encode"> + + <refentry id="function.imap-setflag-full"> <refnamediv> - <refname>imap_utf7_encode</refname> - <refpurpose> - Converts 8bit data to modified UTF-7 text. - </refpurpose> + <refname>imap_setflag_full</refname> + <refpurpose>Sets flags on messages</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>string <function>imap_utf7_encode</function></funcdef> - <paramdef>string <parameter>data</parameter></paramdef> + <funcdef>string <function>imap_setflag_full</function></funcdef> + <paramdef>int <parameter>stream</parameter></paramdef> + <paramdef>string <parameter>sequence</parameter></paramdef> + <paramdef>string <parameter>flag</parameter></paramdef> + <paramdef>string <parameter>options</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - Converts 8bit <parameter>data</parameter> to modified UTF-7 - text. This is needed to encode mailbox names that contain - international characters outside of the printable ASCII - range. The modified UTF-7 encoding is defined in <ulink - url="&url.rfc;rfc2060.html">RFC 2060</ulink>, section 5.1.3 - (original UTF-7 was defned in <ulink - url="&url.rfc;rfc1642.html">RFC1642</ulink>). + This function causes a store to add the specified flag to the + flags set for the messages in the specified sequence. </para> <para> - Returns the modified UTF-7 text. + The flags which you can set are "\\Seen", "\\Answered", + "\\Flagged", "\\Deleted", "\\Draft", and "\\Recent" (as defined + by RFC2060). + </para> + <para> + The options are a bit mask with one or more of the following: + <informalexample> + <literallayout> +ST_UID The sequence argument contains UIDs instead of + sequence numbers + </literallayout> + </informalexample> </para> + <para> + <example> + <title><function>imap_setflag_full</function> example</title> + <programlisting role="php"> +$mbox = imap_open("{your.imap.host:143}","username","password") + || die("can't connect: ".imap_last_error()); + +$status = imap_setflag_full($mbox,"2,5","\\Seen \\Flagged"); + +print gettype($status)."\n"; +print $status."\n"; + +imap_close($mbox); + </programlisting> + </example> + </para> + </refsect1> </refentry> - <refentry id="function.imap-utf8"> + <refentry id="function.imap-sort"> <refnamediv> - <refname>imap_utf8</refname> - <refpurpose> - Converts text to UTF8 - </refpurpose> + <refname>imap_sort</refname> + <refpurpose>Sort an array of message headers</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>string <function>imap_utf8</function></funcdef> - <paramdef>string <parameter>text</parameter></paramdef> + <funcdef>array <function>imap_sort</function></funcdef> + <paramdef>int <parameter>stream</parameter></paramdef> + <paramdef>int <parameter>criteria</parameter></paramdef> + <paramdef>int <parameter>reverse</parameter></paramdef> + <paramdef>int <parameter>options</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - Converts the given <parameter>text</parameter> to - UTF8 (as defined in - <ulink url="&url.rfc;rfc2044.html">RFC2044</ulink>). + Returns an array of message numbers sorted by the given + parameters. + </para> + <para> + <parameter>Reverse</parameter> is 1 for reverse-sorting. + </para> + <para> + Criteria can be one (and only one) of the following: + <informalexample> + <literallayout> +SORTDATE message Date +SORTARRIVAL arrival date +SORTFROM mailbox in first From address +SORTSUBJECT message Subject +SORTTO mailbox in first To address +SORTCC mailbox in first cc address +SORTSIZE size of message in octets + </literallayout> + </informalexample> + </para> + <para> + The flags are a bitmask of one or more of the following: + <informalexample> + <literallayout> +SE_UID Return UIDs instead of sequence numbers +SE_NOPREFETCH Don't prefetch searched messages. + </literallayout> + </informalexample> </para> </refsect1> </refentry> - <refentry id="function.imap-fetch-overview"> + <refentry id="function.imap-status"> <refnamediv> - <refname>imap_fetch_overview</refname> + <refname>imap_status</refname> <refpurpose> - Read an overview of the information in the headers of the given message + This function returns status information on a mailbox other than + the current one </refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>array <function>imap_fetch_overview</function></funcdef> + <funcdef>object <function>imap_status</function></funcdef> <paramdef>int <parameter>imap_stream</parameter></paramdef> - <paramdef>string <parameter>sequence</parameter></paramdef> - <paramdef>int <parameter><optional>flags</optional></parameter></paramdef> + <paramdef>string <parameter>mailbox</parameter></paramdef> + <paramdef>int <parameter>options</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - This function fetches mail headers for the given - <parameter>sequence</parameter> and returns an overview of their - contents. <parameter>sequence</parameter> will contain a sequence - of message indices or UIDs, if <parameter>flags</parameter> - contains FT_UID. The returned value is an array of objects - describing one message header each: + This function returns an object containing status + information. Valid flags are: <itemizedlist> <listitem> - <simpara> - subject - the messages subject - </simpara> - </listitem> - <listitem> - <simpara> - from - who sent it - </simpara> - </listitem> - <listitem> - <simpara> - date - when was it sent - </simpara> - </listitem> - <listitem> - <simpara> - message_id - Message-ID - </simpara> - </listitem> - <listitem> - <simpara> - references - is a reference to this message id - </simpara> - </listitem> - <listitem> - <simpara> - size - size in bytes - </simpara> - </listitem> - <listitem> - <simpara> - uid - UID the message has in the mailbox - </simpara> - </listitem> - <listitem> - <simpara> - msgno - message sequence number in the maibox - </simpara> - </listitem> - <listitem> <simpara> - recent - this message is flagged as recent + SA_MESSAGES - set status->messages to the number of messages + in the mailbox </simpara> </listitem> <listitem> <simpara> - flagged - this message is flagged + SA_RECENT - set status->recent to the number of recent + messages in the mailbox </simpara> </listitem> <listitem> <simpara> - answered - this message is flagged as answered + SA_UNSEEN - set status->unseen to the number of unseen (new) + messages in the mailbox </simpara> </listitem> <listitem> <simpara> - deleted - this message is flagged for deletion + SA_UIDNEXT - set status->uidnext to the next uid to be used in + the mailbox </simpara> </listitem> <listitem> <simpara> - seen - this message is flagged as already read + SA_UIDVALIDITY - set status->uidvalidity to a constant that + changes when uids for the mailbox may no longer be valid </simpara> </listitem> <listitem> <simpara> - draft - this message is flagged as being a draft + SA_ALL - set all of the above </simpara> </listitem> </itemizedlist> </para> <para> + status->flags is also set, which contains a bitmask which can be + checked against any of the above constants. + </para> + <para> <example> - <title><function>imap_fetch_overview</function> example</title> + <title><function>imap_status</function> example</title> <programlisting role="php"> -$mbox = imap_open("{your.imap.host:143}","username","password") - || die("can't connect: ".imap_last_error()); - -$overview = imap_fetch_overview($mbox,"2,4:6",0); +$mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN) + || die("can't connect: ".imap_last_error()); -if(is_array($overview)) { - reset($overview); - while( list($key,$val) = each($overview)) { - print $val->msgno - . " - " . $val->date - . " - " . $val->subject - . "\n"; - } -} +$status = imap_status($mbox,"{your.imap.host}INBOX",SA_ALL); +if($status) { + print("Messages: ". $status->messages )."<br>\n"; + print("Recent: ". $status->recent )."<br>\n"; + print("Unseen: ". $status->unseen )."<br>\n"; + print("UIDnext: ". $status->uidnext )."<br>\n"; + print("UIDvalidity:". $status->uidvalidity)."<br>\n"; +} else + print "imap_status failed: ".imap_lasterror()."\n"; imap_close($mbox); </programlisting> @@ -2728,143 +2700,186 @@ </refsect1> </refentry> - <refentry id="function.imap-mime-header-decode"> + + <refentry id="function.imap-subscribe"> <refnamediv> - <refname>imap_mime_header_decode</refname> - <refpurpose>Decode MIME header elements</refpurpose> + <refname>imap_subscribe</refname> + <refpurpose>Subscribe to a mailbox</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>array <function>imap_header_decode</function></funcdef> - <paramdef>string <parameter>text</parameter></paramdef> + <funcdef>int <function>imap_subscribe</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + <paramdef>string <parameter>mbox</parameter></paramdef> </funcprototype> </funcsynopsis> + <para> + Subscribe to a new mailbox. + </para> <para> - <function>imap_mime_header_decode</function> function decodes - MIME message header extensions that are non ASCII text - (see <ulink url="&url.rfc;rfc2047.html">RFC2047</ulink>) - The decoded elements are returned in an array of objects, - where each object has two properties, "charset" & "text". - If the element hasn't been encoded, and in other words is in - plain US-ASCII,the "charset" property of that element is set to - "default". + Returns true on success and false on error. </para> + </refsect1> + </refentry> + + <refentry id="function.imap-uid"> + <refnamediv> + <refname>imap_uid</refname> + <refpurpose> + This function returns the UID for the given message sequence + number + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imap_uid</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + <paramdef>int <parameter>msgno</parameter></paramdef> + </funcprototype> + </funcsynopsis> <para> - <example> - <title><function>imap_mime_header_decode</function> example</title> - <programlisting role="php"> -$text="=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <[EMAIL PROTECTED]>"; + This function returns the UID for the given message sequence + number. An UID is an unique identifier that will not change over + time while a message sequence number may change whenever the + content of the mailbox changes. This function is the inverse of + <function>imap_msgno</function>. + </para> + </refsect1> + </refentry> -$elements=imap_mime_header_decode($text); -for($i=0;$i<count($elements);$i++) { - echo "Charset: {$elements[$i]->charset}\n"; - echo "Text: {$elements[$i]->text}\n\n"; -} + <refentry id="function.imap-undelete"> + <refnamediv> + <refname>imap_undelete</refname> + <refpurpose> + Unmark the message which is marked deleted + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imap_undelete</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + <paramdef>int <parameter>msg_number</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function removes the deletion flag for a specified message, + which is set by <function>imap_delete</function> or + <function>imap_mail_move</function>. + </para> + <para> + Returns true on success and false on error. + </para> + </refsect1> + </refentry> - </programlisting> - </example> + <refentry id="function.imap-unsubscribe"> + <refnamediv> + <refname>imap_unsubscribe</refname> + <refpurpose>Unsubscribe from a mailbox</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imap_unsubscribe</function></funcdef> + <paramdef>int <parameter>imap_stream</parameter></paramdef> + <paramdef>string <parameter>mbox</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + Unsubscribe from a specified mailbox. </para> <para> - In the above example we would have two elements, whereas the first - element had previously been encoded with ISO-8859-1, and the second - element would be plain US-ASCII. + Returns true on success and false on error. </para> </refsect1> </refentry> - - <refentry id="function.imap-mail-compose"> + + <refentry id="function.imap-utf7-decode"> <refnamediv> - <refname>imap_mail_compose</refname> + <refname>imap_utf7_decode</refname> <refpurpose> - Create a MIME message based on given envelope and body sections + Decodes a modified UTF-7 encoded string. </refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>string <function>imap_mail_compose</function></funcdef> - <paramdef>array <parameter>envelope</parameter></paramdef> - <paramdef>array <parameter>body</parameter></paramdef> + <funcdef>string <function>imap_utf7_decode</function></funcdef> + <paramdef>string <parameter>text</parameter></paramdef> </funcprototype> </funcsynopsis> - <para> + <para> + Decodes modified UTF-7 <parameter>text</parameter> into 8bit data. </para> <para> - <example> - <title><function>imap_mail_compose</function> example</title> - <programlisting role="php"> -<?php - -$envelope["from"]="[EMAIL PROTECTED]"; -$envelope["to"]="musone@darkstar"; -$envelope["cc"]="[EMAIL PROTECTED]"; - -$part1["type"]=TYPEMULTIPART; -$part1["subtype"]="mixed"; - -$filename="/tmp/imap.c.gz"; -$fp=fopen($filename,"r"); -$contents=fread($fp,filesize($filename)); -fclose($fp); - -$part2["type"]=TYPEAPPLICATION; -$part2["encoding"]=ENCBINARY; -$part2["subtype"]="octet-stream"; -$part2["description"]=basename($filename); -$part2["contents.data"]=$contents; - -$part3["type"]=TYPETEXT; -$part3["subtype"]="plain"; -$part3["description"]="description3"; -$part3["contents.data"]="contents.data3\n\n\n\t"; - -$body[1]=$part1; -$body[2]=$part2; -$body[3]=$part3; - -echo nl2br(imap_mail_compose($envelope,$body)); + Returns the decoded 8bit data, or false if the input string was + not valid modified UTF-7. This function is needed to decode + mailbox names that contain international characters outside of + the printable ASCII range. The modified UTF-7 encoding is defined + in <ulink url="&url.rfc;rfc2060.html">RFC 2060</ulink>, section + 5.1.3 (original UTF-7 was defned in <ulink + url="&url.rfc;rfc1642.html">RFC1642</ulink>). + </para> + </refsect1> + </refentry> -?> - </programlisting> - </example> + <refentry id="function.imap-utf7-encode"> + <refnamediv> + <refname>imap_utf7_encode</refname> + <refpurpose> + Converts 8bit data to modified UTF-7 text. + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>imap_utf7_encode</function></funcdef> + <paramdef>string <parameter>data</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + Converts 8bit <parameter>data</parameter> to modified UTF-7 + text. This is needed to encode mailbox names that contain + international characters outside of the printable ASCII + range. The modified UTF-7 encoding is defined in <ulink + url="&url.rfc;rfc2060.html">RFC 2060</ulink>, section 5.1.3 + (original UTF-7 was defned in <ulink + url="&url.rfc;rfc1642.html">RFC1642</ulink>). + </para> + <para> + Returns the modified UTF-7 text. </para> </refsect1> </refentry> - <refentry id="function.imap-mail"> + <refentry id="function.imap-utf8"> <refnamediv> - <refname>imap_mail</refname> + <refname>imap_utf8</refname> <refpurpose> - Send an email message + Converts text to UTF8 </refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>string <function>imap_mail</function></funcdef> - <paramdef>string <parameter>to</parameter></paramdef> - <paramdef>string <parameter>subject</parameter></paramdef> - <paramdef>string <parameter>message</parameter></paramdef> - <paramdef>string - <parameter><optional>additional_headers</optional></parameter> - </paramdef> - <paramdef>string - <parameter><optional>cc</optional></parameter> - </paramdef> - <paramdef>string - <parameter><optional>bcc</optional></parameter> - </paramdef> - <paramdef>string - <parameter><optional>rpath</optional></parameter> - </paramdef> + <funcdef>string <function>imap_utf8</function></funcdef> + <paramdef>string <parameter>text</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - This function is currently only available in PHP 3. + Converts the given <parameter>text</parameter> to + UTF8 (as defined in + <ulink url="&url.rfc;rfc2044.html">RFC2044</ulink>). </para> </refsect1> </refentry>