https://github.com/uw-imap/imap and compile it.) // ============================== USING FUNCTIONS (76) // imap_8bit() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_alerts() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_append() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_base64() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_binary() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_body() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_bodystruct() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_check() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_clearflag_full() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_close() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_create() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_createmailbox() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_delete() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_deletemailbox() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_errors() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_expunge() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_fetch_overview() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_fetchbody() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_fetchheader() - PHP_4, PHP_5, PHP_7, PHP_8 // OFFLINE | imap_fetchmime() - PHP_5 >= PHP_5_3_6, PHP_7, PHP_8 // imap_fetchstructure() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_fetchtext() - PHP_4, PHP_5, PHP_7, PHP_8 // OFFLINE | imap_gc() - PHP_5 >= PHP_5_3_0, PHP_7, PHP_8 // imap_get_quota() - PHP_4 >= PHP_4_0_5, PHP_5, PHP_7, PHP_8 // imap_get_quotaroot() - PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // OFFLINE | imap_getacl() - PHP_5, PHP_7, PHP_8 // imap_getmailboxes() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_getsubscribed() - PHP_4, PHP_5, PHP_7, PHP_8 // OFFLINE | imap_header() - PHP_4, PHP_5, PHP_7 // imap_headerinfo() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_headers() - PHP_4, PHP_5, PHP_7, PHP_8 // OFFLINE | imap_is_open() - PHP_8 >= PHP_8_2_1 // imap_last_error() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_list() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_listmailbox() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_listscan() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_listsubscribed() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_lsub() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_mail_compose() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_mail_copy() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_mail_move() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_mail() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_mailboxmsginfo() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_mime_header_decode() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_msgno() - PHP_4, PHP_5, PHP_7, PHP_8 // OFFLINE | imap_mutf7_to_utf8() - PHP_5 >= PHP_5_3_0, PHP_7, PHP_8 // imap_num_msg() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_num_recent() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_open() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_ping() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_qprint() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_rename() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_renamemailbox() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_reopen() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_rfc822_parse_adrlist() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_rfc822_parse_headers() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_rfc822_write_address() - PHP_4, PHP_5, PHP_7, PHP_8 // OFFLINE | imap_savebody() - PHP_5 >= PHP_5_1_3, PHP_7, PHP_8 // imap_scan() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_scanmailbox() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_search() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_set_quota() - PHP_4 >= PHP_4_0_5, PHP_5, PHP_7, PHP_8 // imap_setacl() - PHP_4 >= PHP_4_0_7, PHP_5, PHP_7, PHP_8 // imap_setflag_full() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_sort() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_status() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_subscribe() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_thread() - PHP_4 >= PHP_4_0_7, PHP_5, PHP_7, PHP_8 // imap_timeout() - PHP_4 >= PHP_4_3_3, PHP_5, PHP_7, PHP_8 // imap_uid() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_undelete() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_unsubscribe() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_utf7_decode() - PHP_4, PHP_5, PHP_7, PHP_8 // imap_utf7_encode() - PHP_4, PHP_5, PHP_7, PHP_8 // OFFLINE | imap_utf8_to_mutf7() - PHP_5 >= PHP_5_3_0, PHP_7, PHP_8 // imap_utf8() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== USING CLASSES (0) // ============================== USING DATA_TYPES (8) // string // false // array // bool // OFFLINE | IMAP\Connection - PHP_8 >= PHP_8_1_0 // int // stdClass // resource // ============================== END // REQUIREMENTS // ============================== // ============================== BEGIN // PHP_MAIL_IMAP // ============================== ABOUT // PHP Manual / Function Reference / Mail Related Extensions / IMAP - IMAP, POP3 and NNTP // URL: https://www.php.net/manual/en/book.imap.php // ============================== DESCRIPTION // IMAP_POP3_AND_NNTP // // IMAP_POP3_AND_NNTP - BEGIN // IMAP, POP3 and NNTP // // INTRODUCTION // INSTALLING_CONFIGURING // PREDEFINED_CONSTANTS // IMAP_FUNCTIONS // THE_IMAP_CONNECTION_CLASS // // INTRODUCTION - BEGIN // Introduction // // These functions enable you to operate with the IMAP protocol, as well as the NNTP, POP3 and local mailbox access methods. // Be warned, however, that some IMAP functions will not work correctly with the POP protocol. // Warning: The IMAP extension is not thread-safe; it should not be used with ZTS builds. // // LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/intro.imap.php // INTRODUCTION - END // // INSTALLING_CONFIGURING - BEGIN // Installing/Configuring // // REQUIREMENTS // INSTALLATION // RUNTIME_CONFIGURATION // RESOURCE_TYPES // // REQUIREMENTS - BEGIN // Requirements // // This extension requires the c-client library to be installed. Grab the latest version from > https://github.com/uw-imap/imap and compile it. // It's important that you do not copy the IMAP source files directly into the system include directory as there may be conflicts. Instead, create a new directory inside the system include directory, such as /usr/local/imap-2000b/ (location and name depend on your setup and IMAP version), and inside this new directory create additional directories named lib/ and include/. From the c-client directory from your IMAP source tree, copy all the *.h files into include/ and all the *.c files into lib/. Additionally when you compiled IMAP, a file named c-client.a was created. Also put this in the lib/ directory but rename it as libc-client.a. // Note: To build the c-client library with SSL or/and Kerberos support read the docs supplied with the package. // Note: In Mandrake Linux, the IMAP library (libc-client.a) is compiled without Kerberos support. A separate version with SSL (client-PHP4.a) is installed. The library must be recompiled in order to add Kerberos support. // // LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/imap.requirements.php // REQUIREMENTS - END // // INSTALLATION - BEGIN // Installation // // To get these functions to work, you have to compile PHP with --with-imap[=DIR], where DIR is the c-client install prefix. From our example above, you would use --with-imap=/usr/local/imap-2000b. This location depends on where you created this directory according to the description above. Windows users may include the php_imap.dll DLL in php.ini. // Note: Depending on how the c-client was configured, you might also need to add --with-imap-ssl=/path/to/openssl/ and/or --with-kerberos=/path/to/kerberos to the PHP configure line. // Warning: The IMAP extension is not thread-safe; it should not be used with ZTS builds. // Warning: The IMAP, recode and YAZ extensions cannot be used in conjunction, because they share the same internal symbols. Note: Yaz 2.0 and above does not suffer from this problem.s // // LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/imap.installation.php // INSTALLATION - END // // RUNTIME_CONFIGURATION - BEGIN // Runtime Configuration // // The behaviour of these functions is affected by settings in php.ini. // // IMAP Configure Options // Name | Default | Changeable | Changelog // imap.enable_insecure_rsh | "0" | PHP_INI_SYSTEM | Available as of PHP 7.1.25, 7.2.13 and 7.3.0. Formerly, it was implicitly enabled. // // For further details and definitions of the PHP_INI_* modes, see the Where a configuration setting may be set. // Here's a short explanation of the configuration directives. // // imap.enable_insecure_rsh bool - Establishing a connection to a server may invoke rsh or ssh commands, unless this php.ini option is disabled. // Warning: Neither PHP nor the IMAP library filter mailbox names before passing them to rsh or ssh commands, thus passing untrusted data to this function without disabling this php.ini option is insecure. // // LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/imap.configuration.php // RUNTIME_CONFIGURATION - END // // RESOURCE_TYPES - BEGIN // Resource Types // // Prior to PHP 8.1.0, this extension defined the resource type imap as returned by imap_open() references an opened IMAP stream. // // LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/imap.resources.php // RESOURCE_TYPES - END // // LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/imap.setup.php // INSTALLING_CONFIGURING - END // // PREDEFINED_CONSTANTS - BEGIN // Predefined Constants // // The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime. // // NIL (int) - Deprecated as of PHP 8.1.0. // OP_DEBUG (int) - // OP_READONLY (int) - Open mailbox read-only // OP_ANONYMOUS (int) - Don't use or update a .newsrc for news (NNTP only) // OP_SHORTCACHE (int) - // OP_SILENT (int) - // OP_PROTOTYPE (int) - // OP_HALFOPEN (int) - For IMAP and NNTP names, open a connection but don't open a mailbox. // OP_EXPUNGE (int) - // OP_SECURE (int) - // CL_EXPUNGE (int) - silently expunge the mailbox before closing when calling imap_close() // FT_UID (int) - The parameter is a UID // FT_PEEK (int) - Do not set the \Seen flag if not already set // FT_NOT (int) - // FT_INTERNAL (int) - The return string is in internal format, will not canonicalize to CRLF. // FT_PREFETCHTEXT (int) - // ST_UID (int) - The sequence argument contains UIDs instead of sequence numbers // ST_SILENT (int) - // ST_SET (int) - // CP_UID (int) - the sequence numbers contain UIDS // CP_MOVE (int) - Delete the messages from the current mailbox after copying with imap_mail_copy() // SE_UID (int) - Return UIDs instead of sequence numbers // SE_FREE (int) - // SE_NOPREFETCH (int) - Don't prefetch searched messages // SO_FREE (int) - // SO_NOSERVER (int) - // SA_MESSAGES (int) - // SA_RECENT (int) - // SA_UNSEEN (int) - // SA_UIDNEXT (int) - // SA_UIDVALIDITY (int) - // SA_ALL (int) - // LATT_NOINFERIORS (int) - This mailbox has no "children" (there are no mailboxes below this one). // LATT_NOSELECT (int) - This is only a container, not a mailbox - you cannot open it. // LATT_MARKED (int) - This mailbox is marked. Only used by UW-IMAPD. // LATT_UNMARKED (int) - This mailbox is not marked. Only used by UW-IMAPD. // LATT_REFERRAL (int) - This container has a referral to a remote mailbox. // LATT_HASCHILDREN (int) - This mailbox has selectable inferiors. // LATT_HASNOCHILDREN (int) - This mailbox has no selectable inferiors. // SORTDATE (int) - Sort criteria for imap_sort(): message Date // SORTARRIVAL (int) - Sort criteria for imap_sort(): arrival date // SORTFROM (int) - Sort criteria for imap_sort(): mailbox in first From address // SORTSUBJECT (int) - Sort criteria for imap_sort(): message subject // SORTTO (int) - Sort criteria for imap_sort(): mailbox in first To address // SORTCC (int) - Sort criteria for imap_sort(): mailbox in first cc address // SORTSIZE (int) - Sort criteria for imap_sort(): size of message in octets // TYPETEXT (int) - Primary body type: unformatted text // TYPEMULTIPART (int) - Primary body type: multiple part // TYPEMESSAGE (int) - Primary body type: encapsulated message // TYPEAPPLICATION (int) - Primary body type: application data // TYPEAUDIO (int) - Primary body type: audio // TYPEIMAGE (int) - Primary body type: static image // TYPEVIDEO (int) - Primary body type: video // TYPEMODEL (int) - Primary body type: model // TYPEOTHER (int) - Primary body type: unknown // ENC7BIT (int) - Body encoding: 7 bit SMTP semantic data // ENC8BIT (int) - Body encoding: 8 bit SMTP semantic data // ENCBINARY (int) - Body encoding: 8 bit binary data // ENCBASE64 (int) - Body encoding: base-64 encoded data // ENCQUOTEDPRINTABLE (int) - Body encoding: human-readable 8-as-7 bit data // ENCOTHER (int) - Body encoding: unknown // IMAP_OPENTIMEOUT (int) - // IMAP_READTIMEOUT (int) - // IMAP_WRITETIMEOUT (int) - // IMAP_CLOSETIMEOUT (int) - // IMAP_GC_ELT (int) - Garbage collector, clear message cache elements. // IMAP_GC_ENV (int) - Garbage collector, clear envelopes and bodies. // IMAP_GC_TEXTS (int) - Garbage collector, clear texts. // // LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/imap.constants.php // PREDEFINED_CONSTANTS - END // // IMAP_FUNCTIONS - BEGIN // IMAP Functions // // See Also // This document can't go into detail on all the topics touched by the provided functions. Further information is provided by the documentation of the c-client library source (docs/internal.txt). and the following RFC documents: // * > RFC2821 : Simple Mail Transfer Protocol (SMTP). // * > RFC2822 : Standard for ARPA internet text messages. // * > RFC2060 : Internet Message Access Protocol (IMAP) Version 4rev1. // * > RFC1939 : Post Office Protocol Version 3 (POP3). // * > RFC977 : Network News Transfer Protocol (NNTP). // * > RFC2076 : Common Internet Message Headers. // * > RFC2045 , > RFC2046 , > RFC2047 , > RFC2048 & > RFC2049: Multipurpose Internet Mail Extensions (MIME). // A detailed overview is also available in the books > Programming Internet Email by David Wood and > Managing IMAP by Dianna Mullet & Kevin Mullet. // // Table of Contents // * imap_8bit - Convert an 8bit string to a quoted-printable string // * imap_alerts - Returns all IMAP alert messages that have occurred // * imap_append - Append a string message to a specified mailbox // * imap_base64 - Decode BASE64 encoded text // * imap_binary - Convert an 8bit string to a base64 string // * imap_body - Read the message body // * imap_bodystruct - Read the structure of a specified body section of a specific message // * imap_check - Check current mailbox // * imap_clearflag_full - Clears flags on messages // * imap_close - Close an IMAP stream // * imap_create - Alias of imap_createmailbox // * imap_createmailbox - Create a new mailbox // * imap_delete - Mark a message for deletion from current mailbox // * imap_deletemailbox - Delete a mailbox // * imap_errors - Returns all of the IMAP errors that have occurred // * imap_expunge - Delete all messages marked for deletion // * imap_fetch_overview - Read an overview of the information in the headers of the given message // * imap_fetchbody - Fetch a particular section of the body of the message // * imap_fetchheader - Returns header for a message // * imap_fetchmime - Fetch MIME headers for a particular section of the message // * imap_fetchstructure - Read the structure of a particular message // * imap_fetchtext - Alias of imap_body // * imap_gc - Clears IMAP cache // * imap_get_quota - Retrieve the quota level settings, and usage statics per mailbox // * imap_get_quotaroot - Retrieve the quota settings per user // * imap_getacl - Gets the ACL for a given mailbox // * imap_getmailboxes - Read the list of mailboxes, returning detailed information on each one // * imap_getsubscribed - List all the subscribed mailboxes // * imap_header - Alias of imap_headerinfo // * imap_headerinfo - Read the header of the message // * imap_headers - Returns headers for all messages in a mailbox // * imap_is_open - Check if the IMAP stream is still valid // * imap_last_error - Gets the last IMAP error that occurred during this page request // * imap_list - Read the list of mailboxes // * imap_listmailbox - Alias of imap_list // * imap_listscan - Returns the list of mailboxes that matches the given text // * imap_listsubscribed - Alias of imap_lsub // * imap_lsub - List all the subscribed mailboxes // * imap_mail_compose - Create a MIME message based on given envelope and body sections // * imap_mail_copy - Copy specified messages to a mailbox // * imap_mail_move - Move specified messages to a mailbox // * imap_mail - Send an email message // * imap_mailboxmsginfo - Get information about the current mailbox // * imap_mime_header_decode - Decode MIME header elements // * imap_msgno - Gets the message sequence number for the given UID // * imap_mutf7_to_utf8 - Decode a modified UTF-7 string to UTF-8 // * imap_num_msg - Gets the number of messages in the current mailbox // * imap_num_recent - Gets the number of recent messages in current mailbox // * imap_open - Open an IMAP stream to a mailbox // * imap_ping - Check if the IMAP stream is still active // * imap_qprint - Convert a quoted-printable string to an 8 bit string // * imap_rename - Alias of imap_renamemailbox // * imap_renamemailbox - Rename an old mailbox to new mailbox // * imap_reopen - Reopen IMAP stream to new mailbox // * imap_rfc822_parse_adrlist - Parses an address string // * imap_rfc822_parse_headers - Parse mail headers from a string // * imap_rfc822_write_address - Returns a properly formatted email address given the mailbox, host, and personal info // * imap_savebody - Save a specific body section to a file // * imap_scan - Alias of imap_listscan // * imap_scanmailbox - Alias of imap_listscan // * imap_search - This function returns an array of messages matching the given search criteria // * imap_set_quota - Sets a quota for a given mailbox // * imap_setacl - Sets the ACL for a given mailbox // * imap_setflag_full - Sets flags on messages // * imap_sort - Gets and sort messages // * imap_status - Returns status information on a mailbox // * imap_subscribe - Subscribe to a mailbox // * imap_thread - Returns a tree of threaded message // * imap_timeout - Set or fetch imap timeout // * imap_uid - This function returns the UID for the given message sequence number // * imap_undelete - Unmark the message which is marked deleted // * imap_unsubscribe - Unsubscribe from a mailbox // * imap_utf7_decode - Decodes a modified UTF-7 encoded string // * imap_utf7_encode - Converts ISO-8859-1 string to modified UTF-7 text // * imap_utf8_to_mutf7 - Encode a UTF-8 string to modified UTF-7 // * imap_utf8 - Converts MIME-encoded text to UTF-8 // // LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/ref.imap.php // IMAP_FUNCTIONS - END // // THE_IMAP_CONNECTION_CLASS - BEGIN // The IMAP\Connection class // // PHP_8 >= PHP_8_1_0 // // Introduction // A fully opaque class which replaces a imap resource as of PHP 8.1.0. // // Class synopsis // [code] // final class IMAP\Connection { // } // [/code] // // LITERATURE_SOURCES // * PHP_NET (2023-11-11) // URL: https://www.php.net/manual/en/class.imap-connection.php // THE_IMAP_CONNECTION_CLASS - BEGIN // // LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/book.imap.php // IMAP_POP3_AND_NNTP - END // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_8BIT // ============================== PUBLIC // ============================== ABOUT // Convert an 8bit string to a quoted-printable string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_8bit() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_8bit($string) { $return_imap_8bit = false; // ========== IMAP_8BIT - BEGIN // ===== ABOUT // Convert an 8bit string to a quoted-printable string // ===== DESCRIPTION // Convert an 8bit string to a quoted-printable string (according to > RFC2045, section 6.7). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_8bit(string $string): string|false // ===== CODE $return_imap_8bit = imap_8bit( $string // string string - The 8bit string to convert ); // Return Values // Returns a quoted-printable string, or false on failure. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/function.imap-8bit.php // ========== IMAP_8BIT - END // SYNTAX: // string|false imap_8bit(string $string) return $return_imap_8bit; // string|false } // ============================== END // PHP_MAIL_IMAP_IMAP_8BIT // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_ALERTS // ============================== PUBLIC // ============================== ABOUT // Returns all IMAP alert messages that have occurred. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_alerts() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_alerts() { $return_imap_alerts = false; // ========== IMAP_ALERTS - BEGIN // ===== ABOUT // Returns all IMAP alert messages that have occurred // ===== DESCRIPTION // Returns all of the IMAP alert messages generated since the last imap_alerts() call, or the beginning of the page. // When imap_alerts() is called, the alert stack is subsequently cleared. The IMAP specification requires that these messages be passed to the user. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_alerts(): array|false // ===== CODE $return_imap_alerts = imap_alerts( // This function has no parameters. ); // Return Values // Returns an array of all of the IMAP alert messages generated or false if no alert messages are available. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/function.imap-alerts.php // ========== IMAP_ALERTS - END // SYNTAX: // array|false imap_alerts() return $return_imap_alerts; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_ALERTS // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_APPEND // ============================== PUBLIC // ============================== ABOUT // Append a string message to a specified mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_append() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_append($imap, $folder, $message, $options = null, $internal_date = null) { $return_imap_append = false; // ========== IMAP_APPEND - BEGIN // ===== ABOUT // Append a string message to a specified mailbox // ===== DESCRIPTION // Appends a string message to the specified folder. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_append( // IMAP\Connection $imap, // string $folder, // string $message, // ?string $options = null, // ?string $internal_date = null // ): bool // ===== CODE $return_imap_append = imap_append( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $folder, // string folder - The mailbox name, see imap_open() for more information // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. $message, // string message - The message to be append, as a string // When talking to the Cyrus IMAP server, you must use "\r\n" as your end-of-line terminator instead of "\n" or the operation will fail $options, // string options - If provided, the options will also be written to the folder $internal_date // string internal_date - If this parameter is set, it will set the INTERNALDATE on the appended message. The parameter should be a date string that conforms to the rfc2060 specifications for a date_time value. ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // 8.0.0 - options and internal_date are now nullable. // // [examples] // Examples // [example] // Example #1 imap_append() example // [php] // $imap = imap_open("{imap.example.org}INBOX.Drafts", "username", "password"); // // $check = imap_check($imap); // echo "Msg Count before append: ". $check->Nmsgs . "\n"; // // imap_append($imap, "{imap.example.org}INBOX.Drafts" // , "From: me@example.com\r\n" // . "To: you@example.com\r\n" // . "Subject: test\r\n" // . "\r\n" // . "this is a test message, please ignore\r\n" // ); // // $check = imap_check($imap); // echo "Msg Count after append : ". $check->Nmsgs . "\n"; // // imap_close($imap); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-append.php // ========== IMAP_APPEND - END // SYNTAX: // bool imap_append(IMAP\Connection $imap, string $folder, string $message, string $options = null, string $internal_date = null) return $return_imap_append; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_APPEND // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_BASE64 // ============================== PUBLIC // ============================== ABOUT // Decode BASE64 encoded text. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_base64() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_base64($string) { $return_imap_base64 = false; // ========== IMAP_BASE64 - BEGIN // ===== ABOUT // Decode BASE64 encoded text // ===== DESCRIPTION // Decodes the given BASE-64 encoded string. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_base64(string $string): string|false // ===== CODE $return_imap_base64 = imap_base64( $string // string string - The encoded text ); // Return Values // Returns the decoded message as a string, or false on failure. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/function.imap-base64.php // ========== IMAP_BASE64 - END // SYNTAX: // string|false imap_base64(string $string) return $return_imap_base64; // string|false } // ============================== END // PHP_MAIL_IMAP_IMAP_BASE64 // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_BINARY // ============================== PUBLIC // ============================== ABOUT // Convert an 8bit string to a base64 string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_binary() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_binary($string) { $return_imap_binary = false; // ========== IMAP_BINARY - BEGIN // ===== ABOUT // Convert an 8bit string to a base64 string // ===== DESCRIPTION // Convert an 8bit string to a base64 string according to > RFC2045, Section 6.8. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_binary(string $string): string|false // ===== CODE $return_imap_binary = imap_binary( $string // string string - The 8bit string ); // Return Values // Returns a base64 encoded string, or false on failure. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/function.imap-binary.php // ========== IMAP_BINARY - END // SYNTAX: // string|false imap_binary(string $string) return $return_imap_binary; // string|false } // ============================== END // PHP_MAIL_IMAP_IMAP_BINARY // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_BODY // ============================== PUBLIC // ============================== ABOUT // Read the message body. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_body() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_body($imap, $message_num, $flags = 0) { $return_imap_body = false; // ========== IMAP_BODY - BEGIN // ===== ABOUT // Read the message body // ===== DESCRIPTION // imap_body() returns the body of the message, numbered message_num in the current mailbox. // imap_body() will only return a verbatim copy of the message body. To extract single parts of a multipart MIME-encoded message you have to use imap_fetchstructure() to analyze its structure and imap_fetchbody() to extract a copy of a single body component. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_body(IMAP\Connection $imap, int $message_num, int $flags = 0): string|false // ===== CODE $return_imap_body = imap_body( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $message_num, // int message_num - The message number $flags // int flags - The optional flags are a bit mask with one or more of the following: // * FT_UID - The message_num is a UID // * FT_PEEK - Do not set the \Seen flag if not already set // * FT_INTERNAL - The return string is in internal format, will not canonicalize to CRLF. ); // Return Values // Returns the body of the specified message, as a string, or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/function.imap-body.php // ========== IMAP_BODY - END // SYNTAX: // string|false imap_body(IMAP\Connection $imap, int $message_num, int $flags = 0) return $return_imap_body; // string|false } // ============================== END // PHP_MAIL_IMAP_IMAP_BODY // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_BODYSTRUCT // ============================== PUBLIC // ============================== ABOUT // Read the structure of a specified body section of a specific message. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_bodystruct() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_bodystruct($imap, $message_num, $section) { $return_imap_bodystruct = false; // ========== IMAP_BODYSTRUCT - BEGIN // ===== ABOUT // Read the structure of a specified body section of a specific message // ===== DESCRIPTION // Read the structure of a specified body section of a specific message. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_bodystruct(IMAP\Connection $imap, int $message_num, string $section): stdClass|false // ===== CODE $return_imap_bodystruct = imap_bodystruct( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $message_num, // int message_num - The message number $section // string section - The body section to read ); // Return Values // Returns the information in an object, or false on failure. For a detailed description of the object structure and properties see imap_fetchstructure(). // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/function.imap-bodystruct.php // ========== IMAP_BODYSTRUCT - END // SYNTAX: // stdClass|false imap_bodystruct(IMAP\Connection $imap, int $message_num, string $section) return $return_imap_bodystruct; // stdClass|false } // ============================== END // PHP_MAIL_IMAP_IMAP_BODYSTRUCT // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_CHECK // ============================== PUBLIC // ============================== ABOUT // Check current mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_check() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_check($imap) { $return_imap_check = false; // ========== IMAP_CHECK - BEGIN // ===== ABOUT // Check current mailbox // ===== DESCRIPTION // Checks information about the current mailbox. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_check(IMAP\Connection $imap): stdClass|false // ===== CODE $return_imap_check = imap_check( $imap // IMAP\Connection imap - An IMAP\Connection instance. ); // Return Values // Returns the information in an object with following properties: // * Date - current system time formatted according to > RFC2822 // * Driver - protocol used to access this mailbox: POP3, IMAP, NNTP // * Mailbox - the mailbox name // * Nmsgs - number of messages in the mailbox // * Recent - number of recent messages in the mailbox // Returns false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_check() example // [php] // // $imap = imap_check($imap_stream); // var_dump($imap); // // [/php] // The above example will output something similar to: // [result] // object(stdClass)(5) { // ["Date"]=> // string(37) "Wed, 10 Dec 2003 17:56:54 +0100 (CET)" // ["Driver"]=> // string(4) "imap" // ["Mailbox"]=> // string(54) // "{www.example.com:143/imap/user="foo@example.com"}INBOX" // ["Nmsgs"]=> // int(1) // ["Recent"]=> // int(0) // } // [/result] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-check.php // ========== IMAP_CHECK - END // SYNTAX: // stdClass|false imap_check(IMAP\Connection $imap) return $return_imap_check; // stdClass|false } // ============================== END // PHP_MAIL_IMAP_IMAP_CHECK // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_CLEARFLAG_FULL // ============================== PUBLIC // ============================== ABOUT // Clears flags on messages. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_clearflag_full() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_clearflag_full($imap, $sequence, $flag, $options = 0) { $return_imap_clearflag_full = false; // ========== IMAP_CLEARFLAG_FULL - BEGIN // ===== ABOUT // Clears flags on messages // ===== DESCRIPTION // This function causes a store to delete the specified flag to the flags set for the messages in the specified sequence. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_clearflag_full( // IMAP\Connection $imap, // string $sequence, // string $flag, // int $options = 0 // ): true // ===== CODE $return_imap_clearflag_full = imap_clearflag_full( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $sequence, // string sequence - A sequence of message numbers. You can enumerate desired messages with the X,Y syntax, or retrieve all messages within an interval with the X:Y syntax $flag, // string flag - The flags which you can unset are "\\Seen", "\\Answered", "\\Flagged", "\\Deleted", and "\\Draft" (as defined by > RFC2060) $options // int options - options are a bit mask and may contain the single option: // * ST_UID - The sequence argument contains UIDs instead of sequence numbers ); // Return Values // Always returns true. // // Errors/Exceptions // Throws a ValueError if options is invalid. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // 8.0.0 - A ValueError is now thrown on invalid options parameter values. Previously, a warning was emitted and the function returned false. // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-clearflag-full.php // ========== IMAP_CLEARFLAG_FULL - END // SYNTAX: // bool imap_clearflag_full(IMAP\Connection $imap, string $sequence, string $flag, int $options = 0) return $return_imap_clearflag_full; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_CLEARFLAG_FULL // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_CLOSE // ============================== PUBLIC // ============================== ABOUT // Close an IMAP stream. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_close() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_close($imap, $flags = 0) { $return_imap_close = false; // ========== IMAP_CLOSE - BEGIN // ===== ABOUT // Close an IMAP stream // ===== DESCRIPTION // Closes the imap stream. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_close(IMAP\Connection $imap, int $flags = 0): true // ===== CODE $return_imap_close = imap_close( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $flags // int flags - If set to CL_EXPUNGE, the function will silently expunge the mailbox before closing, removing all messages marked for deletion. You can achieve the same thing by using imap_expunge() ); // Return Values // Always returns true. // // Errors/Exceptions // Throws a ValueError if flags is invalid. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // 8.0.0 - A ValueError is now thrown on invalid flags parameter values. Previously, a warning was emitted and the function returned false. // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-close.php // ========== IMAP_CLOSE - END // SYNTAX: // bool imap_close(IMAP\Connection $imap, int $flags = 0) return $return_imap_close; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_CLOSE // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_CREATE // ============================== PUBLIC // ============================== ABOUT // Create a new mailbox. // // imap_create - Alias of imap_createmailbox() // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_create() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_create($imap, $mailbox) { $return_imap_create = false; // ========== IMAP_CREATE - BEGIN // ===== ABOUT // imap_create - Alias of imap_createmailbox() // ===== DESCRIPTION // This function is an alias of: imap_createmailbox(). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // ===== CODE $return_imap_create = imap_create( $imap, // IMAP\Connection $imap $mailbox // string $mailbox ); // Return // bool // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-create.php // ========== IMAP_CREATE - END // ========== IMAP_CREATEMAILBOX - BEGIN // ===== ABOUT // Create a new mailbox // ===== DESCRIPTION // Creates a new mailbox specified by mailbox. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_createmailbox(IMAP\Connection $imap, string $mailbox): bool // ===== CODE // $return_imap_createmailbox = imap_createmailbox( // $imap, // IMAP\Connection imap - An IMAP\Connection instance. // $mailbox // string mailbox - The mailbox name, see imap_open() for more information. Names containing international characters should be encoded by imap_utf7_encode() // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. // ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_createmailbox() example // [php] // $mbox = imap_open("{imap.example.org}", "username", "password", OP_HALFOPEN) // or die("can't connect: " . imap_last_error()); // // $name1 = "phpnewbox"; // $name2 = imap_utf7_encode("phpnewböx"); // phpnewb&w7Y-x // // $newname = $name1; // // echo "Newname will be '$name1'
\n"; // // // we will now create a new mailbox "phptestbox" in your inbox folder, // // check its status after creation and finally remove it to restore // // your inbox to its initial state // // if (@imap_createmailbox($mbox, imap_utf7_encode("{imap.example.org}INBOX.$newname"))) { // $status = @imap_status($mbox, "{imap.example.org}INBOX.$newname", SA_ALL); // if ($status) { // echo "your new mailbox '$name1' has the following status:
\n"; // echo "Messages: " . $status->messages . "
\n"; // echo "Recent: " . $status->recent . "
\n"; // echo "Unseen: " . $status->unseen . "
\n"; // echo "UIDnext: " . $status->uidnext . "
\n"; // echo "UIDvalidity:" . $status->uidvalidity . "
\n"; // // if (imap_renamemailbox($mbox, "{imap.example.org}INBOX.$newname", "{imap.example.org}INBOX.$name2")) { // echo "renamed new mailbox from '$name1' to '$name2'
\n"; // $newname = $name2; // } else { // echo "imap_renamemailbox on new mailbox failed: " . imap_last_error() . "
\n"; // } // } else { // echo "imap_status on new mailbox failed: " . imap_last_error() . "
\n"; // } // // if (@imap_deletemailbox($mbox, "{imap.example.org}INBOX.$newname")) { // echo "new mailbox removed to restore initial state
\n"; // } else { // echo "imap_deletemailbox on new mailbox failed: " . implode("
\n", imap_errors()) . "
\n"; // } // // } else { // echo "could not create new mailbox: " . implode("
\n", imap_errors()) . "
\n"; // } // // imap_close($mbox); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-createmailbox.php // ========== IMAP_CREATEMAILBOX - END // SYNTAX: // bool imap_create(IMAP\Connection $imap, string $mailbox) return $return_imap_create; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_CREATE // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_CREATEMAILBOX // ============================== PUBLIC // ============================== ABOUT // Create a new mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_createmailbox() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_createmailbox($imap, $mailbox) { $return_imap_createmailbox = false; // ========== IMAP_CREATEMAILBOX - BEGIN // ===== ABOUT // Create a new mailbox // ===== DESCRIPTION // Creates a new mailbox specified by mailbox. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_createmailbox(IMAP\Connection $imap, string $mailbox): bool // ===== CODE $return_imap_createmailbox = imap_createmailbox( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $mailbox // string mailbox - The mailbox name, see imap_open() for more information. Names containing international characters should be encoded by imap_utf7_encode() // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_createmailbox() example // [php] // $mbox = imap_open("{imap.example.org}", "username", "password", OP_HALFOPEN) // or die("can't connect: " . imap_last_error()); // // $name1 = "phpnewbox"; // $name2 = imap_utf7_encode("phpnewböx"); // phpnewb&w7Y-x // // $newname = $name1; // // echo "Newname will be '$name1'
\n"; // // // we will now create a new mailbox "phptestbox" in your inbox folder, // // check its status after creation and finally remove it to restore // // your inbox to its initial state // // if (@imap_createmailbox($mbox, imap_utf7_encode("{imap.example.org}INBOX.$newname"))) { // $status = @imap_status($mbox, "{imap.example.org}INBOX.$newname", SA_ALL); // if ($status) { // echo "your new mailbox '$name1' has the following status:
\n"; // echo "Messages: " . $status->messages . "
\n"; // echo "Recent: " . $status->recent . "
\n"; // echo "Unseen: " . $status->unseen . "
\n"; // echo "UIDnext: " . $status->uidnext . "
\n"; // echo "UIDvalidity:" . $status->uidvalidity . "
\n"; // // if (imap_renamemailbox($mbox, "{imap.example.org}INBOX.$newname", "{imap.example.org}INBOX.$name2")) { // echo "renamed new mailbox from '$name1' to '$name2'
\n"; // $newname = $name2; // } else { // echo "imap_renamemailbox on new mailbox failed: " . imap_last_error() . "
\n"; // } // } else { // echo "imap_status on new mailbox failed: " . imap_last_error() . "
\n"; // } // // if (@imap_deletemailbox($mbox, "{imap.example.org}INBOX.$newname")) { // echo "new mailbox removed to restore initial state
\n"; // } else { // echo "imap_deletemailbox on new mailbox failed: " . implode("
\n", imap_errors()) . "
\n"; // } // // } else { // echo "could not create new mailbox: " . implode("
\n", imap_errors()) . "
\n"; // } // // imap_close($mbox); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-createmailbox.php // ========== IMAP_CREATEMAILBOX - END // SYNTAX: // bool imap_createmailbox(IMAP\Connection $imap, string $mailbox) return $return_imap_createmailbox; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_CREATEMAILBOX // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_DELETE // ============================== PUBLIC // ============================== ABOUT // Mark a message for deletion from current mailbox // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_delete() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_delete($imap, $message_nums, $flags = 0) { $return_imap_delete = false; // ========== IMAP_DELETE - BEGIN // ===== ABOUT // Mark a message for deletion from current mailbox // ===== DESCRIPTION // Marks messages listed in message_nums for deletion. Messages marked for deletion will stay in the mailbox until either imap_expunge() is called or imap_close() is called with the optional parameter CL_EXPUNGE. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_delete(IMAP\Connection $imap, string $message_nums, int $flags = 0): true // ===== CODE $return_imap_delete = imap_delete( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $message_nums, // string message_nums - A string representing one or more messages in IMAP4-style sequence format ("n", "n:m", or combination of these delimited by commas). $flags // int flags - You can set the FT_UID which tells the function to treat the message_nums argument as a UID. ); // Return Values // Always returns true. // // Errors/Exceptions // Throws a ValueError if flags is invalid. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // 8.0.0 - A ValueError is now thrown on invalid flags parameter values. Previously, a warning was emitted and the function returned false. // // [examples] // Examples // [example] // Example #1 imap_delete() example // [php] // // $mbox = imap_open("{imap.example.org}INBOX", "username", "password") // or die("Can't connect: " . imap_last_error()); // // $check = imap_mailboxmsginfo($mbox); // echo "Messages before delete: " . $check->Nmsgs . "
\n"; // // imap_delete($mbox, 1); // // $check = imap_mailboxmsginfo($mbox); // echo "Messages after delete: " . $check->Nmsgs . "
\n"; // // imap_expunge($mbox); // // $check = imap_mailboxmsginfo($mbox); // echo "Messages after expunge: " . $check->Nmsgs . "
\n"; // // imap_close($mbox); // [/php] // [/example] // [/examples] // // Notes // Note: IMAP mailboxes may not have their message flags saved between connections, so imap_expunge() should be called during the same connection in order to guarantee that messages marked for deletion will actually be purged. // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-delete.php // ========== IMAP_DELETE - END // SYNTAX: // bool imap_delete(IMAP\Connection $imap, string $message_nums, int $flags = 0) return $return_imap_delete; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_DELETE // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_DELETEMAILBOX // ============================== PUBLIC // ============================== ABOUT // Delete a mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_deletemailbox() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_deletemailbox($imap, $mailbox) { $return_imap_deletemailbox = false; // ========== IMAP_DELETEMAILBOX - BEGIN // ===== ABOUT // Delete a mailbox // ===== DESCRIPTION // Deletes the specified mailbox. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_deletemailbox(IMAP\Connection $imap, string $mailbox): bool // ===== CODE $return_imap_deletemailbox = imap_deletemailbox( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $mailbox // string mailbox - The mailbox name, see imap_open() for more information // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/function.imap-deletemailbox.php // ========== IMAP_DELETEMAILBOX - END // SYNTAX: // bool imap_deletemailbox(IMAP\Connection $imap, string $mailbox) return $return_imap_deletemailbox; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_DELETEMAILBOX // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_ERRORS // ============================== PUBLIC // ============================== ABOUT // Returns all of the IMAP errors that have occurred. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_errors() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_errors() { $return_imap_errors = false; // ========== IMAP_ERRORS - BEGIN // ===== ABOUT // Returns all of the IMAP errors that have occurred // ===== DESCRIPTION // Gets all of the IMAP errors (if any) that have occurred during this page request or since the error stack was reset. // When imap_errors() is called, the error stack is subsequently cleared. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_errors(): array|false // ===== CODE $return_imap_errors = imap_errors( // This function has no parameters. ); // Return Values // This function returns an array of all of the IMAP error messages generated since the last imap_errors() call, or the beginning of the page. Returns false if no error messages are available. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/function.imap-errors.php // ========== IMAP_ERRORS - END // SYNTAX: // array|false imap_errors() return $return_imap_errors; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_ERRORS // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_EXPUNGE // ============================== PUBLIC // ============================== ABOUT // Delete all messages marked for deletion. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_expunge() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_expunge($imap) { $return_imap_expunge = false; // ========== IMAP_EXPUNGE - BEGIN // ===== ABOUT // Delete all messages marked for deletion // ===== DESCRIPTION // Deletes all the messages marked for deletion by imap_delete(), imap_mail_move(), or imap_setflag_full(). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_expunge(IMAP\Connection $imap): bool // ===== CODE $return_imap_expunge = imap_expunge( $imap // IMAP\Connection imap - An IMAP\Connection instance. ); // Return Values // Returns true. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/function.imap-expunge.php // ========== IMAP_EXPUNGE - END // SYNTAX: // bool imap_expunge(IMAP\Connection $imap) return $return_imap_expunge; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_EXPUNGE // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_FETCH_OVERVIEW // ============================== PUBLIC // ============================== ABOUT // Read an overview of the information in the headers of the given message. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_fetch_overview() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_fetch_overview($imap, $sequence, $flags = 0) { $return_imap_fetch_overview = false; // ========== IMAP_FETCH_OVERVIEW - BEGIN // ===== ABOUT // Read an overview of the information in the headers of the given message // ===== DESCRIPTION // This function fetches mail headers for the given sequence and returns an overview of their contents. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_fetch_overview(IMAP\Connection $imap, string $sequence, int $flags = 0): array|false // ===== CODE $return_imap_fetch_overview = imap_fetch_overview( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $sequence, // string sequence - A message sequence description. You can enumerate desired messages with the X,Y syntax, or retrieve all messages within an interval with the X:Y syntax $flags // int flags - sequence will contain a sequence of message indices or UIDs, if this parameter is set to FT_UID. ); // Return Values // Returns an array of objects describing one message header each. The object will only define a property if it exists. The possible properties are: // * subject - the messages subject // * from - who sent it // * to - recipient // * date - when was it sent // * message_id - Message-ID // * references - is a reference to this message id // * in_reply_to - is a reply to this message id // * size - size in bytes // * uid - UID the message has in the mailbox // * msgno - message sequence number in the mailbox // * recent - this message is flagged as recent // * flagged - this message is flagged // * answered - this message is flagged as answered // * deleted - this message is flagged for deletion // * seen - this message is flagged as already read // * draft - this message is flagged as being a draft // * udate - the UNIX timestamp of the arrival date // The function returns false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_fetch_overview() example // [php] // $mbox = imap_open("{imap.example.org:143}INBOX", "username", "password") // or die("can't connect: " . imap_last_error()); // // $MC = imap_check($mbox); // // // Fetch an overview for all messages in INBOX // $result = imap_fetch_overview($mbox,"1:{$MC->Nmsgs}",0); // foreach ($result as $overview) { // echo "#{$overview->msgno} ({$overview->date}) - From: {$overview->from} // {$overview->subject}\n"; // } // imap_close($mbox); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-fetch-overview.php // ========== IMAP_FETCH_OVERVIEW - END // SYNTAX: // array|false imap_fetch_overview(IMAP\Connection $imap, string $sequence, int $flags = 0) return $return_imap_fetch_overview; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_FETCH_OVERVIEW // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_FETCHBODY // ============================== PUBLIC // ============================== ABOUT // Fetch a particular section of the body of the message. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_fetchbody() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_fetchbody($imap, $message_num, $section, $flags = 0) { $return_imap_fetchbody = false; // ========== IMAP_FETCHBODY - BEGIN // ===== ABOUT // Fetch a particular section of the body of the message // ===== DESCRIPTION // Fetch of a particular section of the body of the specified messages. Body parts are not decoded by this function. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_fetchbody( // IMAP\Connection $imap, // int $message_num, // string $section, // int $flags = 0 // ): string|false // ===== CODE $return_imap_fetchbody = imap_fetchbody( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $message_num, // int message_num - The message number $section, // string section - The part number. It is a string of integers delimited by period which index into a body part list as per the IMAP4 specification $flags // int flags - A bitmask with one or more of the following: // * FT_UID - The message_num is a UID // * FT_PEEK - Do not set the \Seen flag if not already set // * FT_INTERNAL - The return string is in internal format, will not canonicalize to CRLF. ); // Return Values // Returns a particular section of the body of the specified messages as a text string, or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/function.imap-fetchbody.php // ========== IMAP_FETCHBODY - END // SYNTAX: // string|false imap_fetchbody(IMAP\Connection $imap, int $message_num, string $section, int $flags = 0) return $return_imap_fetchbody; // string|false } // ============================== END // PHP_MAIL_IMAP_IMAP_FETCHBODY // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_FETCHHEADER // ============================== PUBLIC // ============================== ABOUT // Returns header for a message. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_fetchheader() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_fetchheader($imap, $message_num, $flags = 0) { $return_imap_fetchheader = false; // ========== IMAP_FETCHHEADER - BEGIN // ===== ABOUT // Returns header for a message // ===== DESCRIPTION // This function causes a fetch of the complete, unfiltered > RFC2822 format header of the specified message. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_fetchheader(IMAP\Connection $imap, int $message_num, int $flags = 0): string|false // ===== CODE $return_imap_fetchheader = imap_fetchheader( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $message_num, // int message_num - The message number $flags // int flags - The possible flags are: // * FT_UID - The message_num 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) ); // Return Values // Returns the header of the specified message as a text string, or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-fetchheader.php // ========== IMAP_FETCHHEADER - END // SYNTAX: // string|false imap_fetchheader(IMAP\Connection $imap, int $message_num, int $flags = 0) return $return_imap_fetchheader; // string|false } // ============================== END // PHP_MAIL_IMAP_IMAP_FETCHHEADER // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_FETCHMIME // ============================== OFFLINE // ============================== ABOUT // Fetch MIME headers for a particular section of the message. // ============================== SUPPORT // PHP_5 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_fetchmime() - PHP_5 >= PHP_5_3_6, PHP_7, PHP_8 // ============================== CODE /* function php_mail_imap_imap_fetchmime($imap, $message_num, $section, $flags = 0) { $return_imap_fetchmime = false; // ========== IMAP_FETCHMIME - BEGIN // ===== ABOUT // Fetch MIME headers for a particular section of the message // ===== DESCRIPTION // Fetch the MIME headers of a particular section of the body of the specified messages. // ===== SUPPORTED // PHP_5 >= PHP_5_3_6, PHP_7, PHP_8 // ===== SYNTAX // imap_fetchmime( // IMAP\Connection $imap, // int $message_num, // string $section, // int $flags = 0 // ): string|false // ===== CODE $return_imap_fetchmime = imap_fetchmime( $imap, // MAP\Connection imap - An IMAP\Connection instance. $message_num, // int message_num - The message number $section, // string section - The part number. It is a string of integers delimited by period which index into a body part list as per the IMAP4 specification $flags // int flags - A bitmask with one or more of the following: // * FT_UID - The message_num is a UID // * FT_PEEK - Do not set the \Seen flag if not already set // * FT_INTERNAL - The return string is in internal format, will not canonicalize to CRLF. ); // Return Values // Returns the MIME headers of a particular section of the body of the specified messages as a text string, or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-fetchmime.php // ========== IMAP_FETCHMIME - END // SYNTAX: // string|false imap_fetchmime(IMAP\Connection $imap, int $message_num, string $section, int $flags = 0) return $return_imap_fetchmime; // string|false } */ // ============================== END // PHP_MAIL_IMAP_IMAP_FETCHMIME // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_FETCHSTRUCTURE // ============================== PUBLIC // ============================== ABOUT // Read the structure of a particular message. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_fetchstructure() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_fetchstructure($imap, $message_num, $flags = 0) { $return_imap_fetchstructure = false; // ========== IMAP_FETCHSTRUCTURE - BEGIN // ===== ABOUT // Read the structure of a particular message // ===== DESCRIPTION // Fetches all the structured information for a given message. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_fetchstructure(IMAP\Connection $imap, int $message_num, int $flags = 0): stdClass|false // ===== CODE $return_imap_fetchstructure = imap_fetchstructure( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $message_num, // int message_num - The message number $flags // int flags - This optional parameter only has a single option, FT_UID, which tells the function to treat the message_num argument as a UID. ); // Return Values // Returns an object with properties listed in the table below, or false on failure. // Returned Object for imap_fetchstructure() // type - Primary body type // encoding - Body transfer encoding // ifsubtype - true if there is a subtype string // subtype - MIME subtype // ifdescription - true if there is a description string // description - Content description string // ifid - true if there is an identification string // id - Identification string // lines - Number of lines // bytes - Number of bytes // ifdisposition - true if there is a disposition string // disposition - Disposition string // ifdparameters - true if the dparameters array exists // dparameters - An array of objects where each object has an "attribute" and a "value" property corresponding to the parameters on the Content-disposition MIME header. // ifparameters - true if the parameters array exists // parameters - An array of objects where each object has an "attribute" and a "value" property. // parts - An array of objects identical in structure to the top-level object, each of which corresponds to a MIME body part. // Primary body type (value may vary with used library, use of constants is recommended) // Value (Type) - Constant // 0 (text) - TYPETEXT // 1 (multipart) - TYPEMULTIPART // 2 (message) - TYPEMESSAGE // 3 (application) - TYPEAPPLICATION // 4 (audio) - TYPEAUDIO // 5 (image) - TYPEIMAGE // 6 (video) - TYPEVIDEO // 7 (model) - TYPEMODEL // 8 (other) - TYPEOTHER // Transfer encodings (value may vary with used library, use of constants is recommended) // Value (Type) - Constant // 0 (7bit) - ENC7BIT // 1 (8bit) - ENC8BIT // 2 (Binary) - ENCBINARY // 3 (Base64) - ENCBASE64 // 4 (Quoted-Printable) - ENCQUOTEDPRINTABLE // 5 (other) - ENCOTHER // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-fetchstructure.php // ========== IMAP_FETCHSTRUCTURE - END // SYNTAX: // stdClass|false imap_fetchstructure(IMAP\Connection $imap, int $message_num, int $flags = 0) return $return_imap_fetchstructure; // stdClass|false } // ============================== END // PHP_MAIL_IMAP_IMAP_FETCHSTRUCTURE // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_FETCHTEXT // ============================== PUBLIC // ============================== ABOUT // Read the message body. // // imap_fetchtext - Alias of imap_body() // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_fetchtext() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_fetchtext($imap, $message_num, $flags = 0) { $return_imap_fetchtext = false; // ========== IMAP_FETCHTEXT - BEGIN // ===== ABOUT // imap_fetchtext - Alias of imap_body() // ===== DESCRIPTION // This function is an alias of: imap_body(). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // ===== CODE $return_imap_fetchtext = imap_fetchtext( $imap, // IMAP\Connection $imap $message_num, // int $message_num $flags // int $flags ); // Return // string|false // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-fetchtext.php // ========== IMAP_FETCHTEXT - END // ========== IMAP_BODY - BEGIN // ===== ABOUT // Read the message body // ===== DESCRIPTION // imap_body() returns the body of the message, numbered message_num in the current mailbox. // imap_body() will only return a verbatim copy of the message body. To extract single parts of a multipart MIME-encoded message you have to use imap_fetchstructure() to analyze its structure and imap_fetchbody() to extract a copy of a single body component. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_body(IMAP\Connection $imap, int $message_num, int $flags = 0): string|false // ===== CODE // $return_imap_body = imap_body( // $imap, // IMAP\Connection imap - An IMAP\Connection instance. // $message_num, // int message_num - The message number // $flags // int flags - The optional flags are a bit mask with one or more of the following: // * FT_UID - The message_num is a UID // * FT_PEEK - Do not set the \Seen flag if not already set // * FT_INTERNAL - The return string is in internal format, will not canonicalize to CRLF. // ); // Return Values // Returns the body of the specified message, as a string, or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/function.imap-body.php // ========== IMAP_BODY - END // SYNTAX: // string|false imap_fetchtext(IMAP\Connection $imap, int $message_num, int $flags = 0) return $return_imap_fetchtext; // string|false } // ============================== END // PHP_MAIL_IMAP_IMAP_FETCHTEXT // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_GC // ============================== OFFLINE // ============================== ABOUT // Clears IMAP cache. // ============================== SUPPORT // PHP_5 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_gc() - PHP_5 >= PHP_5_3_0, PHP_7, PHP_8 // ============================== CODE /* function php_mail_imap_imap_gc($imap, $flags) { $return_imap_gc = false; // ========== IMAP_GC - BEGIN // ===== ABOUT // Clears IMAP cache // ===== DESCRIPTION // Purges the cache of entries of a specific type. // ===== SUPPORTED // PHP_5 >= PHP_5_3_0, PHP_7, PHP_8 // ===== SYNTAX // imap_gc(IMAP\Connection $imap, int $flags): true // ===== CODE $return_imap_gc = imap_gc( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $flags // int flags - Specifies the cache to purge. It may one or a combination of the following constants: IMAP_GC_ELT (message cache elements), IMAP_GC_ENV (envelope and bodies), IMAP_GC_TEXTS (texts). ); // Return Values // Always returns true. // // Errors/Exceptions // Throws a ValueError if flags is invalid. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // 8.0.0 - A ValueError is now thrown on invalid flags parameter values. Previously, a warning was emitted and the function returned false. // // [examples] // Examples // [example] // Example #1 imap_gc() example // [php] // // $mbox = imap_open("{imap.example.org:143}", "username", "password"); // // imap_gc($mbox, IMAP_GC_ELT); // // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-gc.php // ========== IMAP_GC - END // SYNTAX: // bool imap_gc(IMAP\Connection $imap, int $flags) return $return_imap_gc; // bool } */ // ============================== END // PHP_MAIL_IMAP_IMAP_GC // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_GET_QUOTA // ============================== PUBLIC // ============================== ABOUT // Retrieve the quota level settings, and usage statics per mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_get_quota() - PHP_4 >= PHP_4_0_5, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_get_quota($imap, $quota_root) { $return_imap_get_quota = false; // ========== IMAP_GET_QUOTA - BEGIN // ===== ABOUT // Retrieve the quota level settings, and usage statics per mailbox // ===== DESCRIPTION // Retrieve the quota level settings, and usage statics per mailbox. // For a non-admin user version of this function, please see the imap_get_quotaroot() function of PHP. // ===== SUPPORTED // PHP_4 >= PHP_4_0_5, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_get_quota(IMAP\Connection $imap, string $quota_root): array|false // ===== CODE $return_imap_get_quota = imap_get_quota( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $quota_root // string quota_root - quota_root should normally be in the form of user.name where name is the mailbox you wish to retrieve information about. ); // Return Values // 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. // As of PHP 4.3, the function more properly reflects the functionality as dictated by the > RFC2087. The array return value has changed to support an unlimited number of returned resources (i.e. messages, or sub-folders) with each named resource receiving an individual array key. Each key value then contains an another array with the usage and limit values within it. // For backwards compatibility reasons, the original access methods are still available for use, although it is suggested to update. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_get_quota() example // [php] // $mbox = imap_open("{imap.example.org}", "mailadmin", "password", OP_HALFOPEN) // or die("can't connect: " . imap_last_error()); // // $quota_value = imap_get_quota($mbox, "user.kalowsky"); // if (is_array($quota_value)) { // echo "Usage level is: " . $quota_value['usage']; // echo "Limit level is: " . $quota_value['limit']; // } // // imap_close($mbox); // [/php] // [/example] // [example] // Example #2 imap_get_quota() 4.3 or greater example // [php] // $mbox = imap_open("{imap.example.org}", "mailadmin", "password", OP_HALFOPEN) // or die("can't connect: " . imap_last_error()); // // $quota_values = imap_get_quota($mbox, "user.kalowsky"); // if (is_array($quota_values)) { // $storage = $quota_values['STORAGE']; // echo "STORAGE usage level is: " . $storage['usage']; // echo "STORAGE limit level is: " . $storage['limit']; // // $message = $quota_values['MESSAGE']; // echo "MESSAGE usage level is: " . $message['usage']; // echo "MESSAGE limit is: " . $message['limit']; // // // ... // } // // imap_close($mbox); // [/php] // [/example] // [/examples] // // Notes // This function is currently only available to users of the c-client2000 or greater library. // The given imap must be opened as the mail administrator, otherwise this function will fail. // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-get-quota.php // ========== IMAP_GET_QUOTA - END // SYNTAX: // array|false imap_get_quota(IMAP\Connection $imap, string $quota_root) return $return_imap_get_quota; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_GET_QUOTA // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_GET_QUOTAROOT // ============================== PUBLIC // ============================== ABOUT // Retrieve the quota settings per user. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_get_quotaroot() - PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_get_quotaroot($imap, $mailbox) { $return_imap_get_quotaroot = false; // ========== IMAP_GET_QUOTAROOT - BEGIN // ===== ABOUT // Retrieve the quota settings per user // ===== DESCRIPTION // Retrieve the quota settings per user. The limit value represents the total amount of space allowed for this user's total mailbox usage. The usage value represents the user's current total mailbox capacity. // ===== SUPPORTED // PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_get_quotaroot(IMAP\Connection $imap, string $mailbox): array|false // ===== CODE $return_imap_get_quotaroot = imap_get_quotaroot( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $mailbox // string mailbox - mailbox should normally be in the form of which mailbox (i.e. INBOX). ); // Return Values // Returns an array of integer values pertaining to the specified user mailbox. All values contain a key based upon the resource name, and a corresponding array with the usage and limit values within. // This function will return false in the case of call failure, and an array of information about the connection upon an un-parsable response from the server. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_get_quotaroot() example // [php] // $mbox = imap_open("{imap.example.org}", "kalowsky", "password", OP_HALFOPEN) // or die("can't connect: " . imap_last_error()); // // $quota = imap_get_quotaroot($mbox, "INBOX"); // if (is_array($quota)) { // $storage = $quota['STORAGE']; // echo "STORAGE usage level is: " . $storage['usage']; // echo "STORAGE limit level is: " . $storage['limit']; // // $message = $quota['MESSAGE']; // echo "MESSAGE usage level is: " . $message['usage']; // echo "MESSAGE limit level is: " . $message['limit']; // // // ... // // } // // imap_close($mbox); // [/php] // [/example] // [/examples] // // Notes // This function is currently only available to users of the c-client2000 or greater library. // The imap should be opened as the user whose mailbox you wish to check. // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-get-quotaroot.php // ========== IMAP_GET_QUOTAROOT - END // SYNTAX: // array|false imap_get_quotaroot(IMAP\Connection $imap, string $mailbox) return $return_imap_get_quotaroot; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_GET_QUOTAROOT // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_GETACL // ============================== OFFLINE // ============================== ABOUT // Gets the ACL for a given mailbox. // ============================== SUPPORT // PHP_5 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_getacl() - PHP_5, PHP_7, PHP_8 // ============================== CODE /* function php_mail_imap_imap_getacl($imap, $mailbox) { $return_imap_getacl = false; // ========== IMAP_GETACL - BEGIN // ===== ABOUT // Gets the ACL for a given mailbox // ===== DESCRIPTION // Gets the ACL for a given mailbox. // ===== SUPPORTED // PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_getacl(IMAP\Connection $imap, string $mailbox): array|false // ===== CODE $return_imap_getacl = imap_getacl( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $mailbox // string mailbox - The mailbox name, see imap_open() for more information // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. ); // Return Values // Returns an associative array of "folder" => "acl" pairs, or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_getacl() example // [php] // // print_r(imap_getacl($imap, 'user.joecool')); // // [/php] The above example will output something similar to: // [result] // Array // ( // [asubfolder] => lrswipcda // [anothersubfolder] => lrswipcda // ) // [/result] // [/example] // [/examples] // // Notes // This function is currently only available to users of the c-client2000 or greater library. // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-getacl.php // ========== IMAP_GETACL - END // SYNTAX: // array|false imap_getacl(IMAP\Connection $imap, string $mailbox) return $return_imap_getacl; // array|false } */ // ============================== END // PHP_MAIL_IMAP_IMAP_GETACL // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_GETMAILBOXES // ============================== PUBLIC // ============================== ABOUT // Read the list of mailboxes, returning detailed information on each one. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_getmailboxes() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_getmailboxes($imap, $reference, $pattern) { $return_imap_getmailboxes = false; // ========== IMAP_GETMAILBOXES - BEGIN // ===== ABOUT // Read the list of mailboxes, returning detailed information on each one // ===== DESCRIPTION // Gets information on the mailboxes. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_getmailboxes(IMAP\Connection $imap, string $reference, string $pattern): array|false // ===== CODE $return_imap_getmailboxes = imap_getmailboxes( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $reference, // string reference - reference should normally be just the server specification as described in imap_open() // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. $pattern // string pattern - Specifies where in the mailbox hierarchy to start searching. // There are two special characters you can pass as part of the pattern: '*' and '%'. '*' means to return all mailboxes. If you pass pattern as '*', you will get a list of the entire mailbox hierarchy. '%' means to return the current level only. '%' as the pattern parameter will return only the top level mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory. ); // Return Values // Returns an array of objects containing mailbox information. Each object has the attributes name, specifying the full name of the mailbox; delimiter, which is the hierarchy delimiter for the part of the hierarchy this mailbox is in; and attributes. Attributes is a bitmask that can be tested against: // * LATT_NOINFERIORS - This mailbox not contains, and may not contain any "children" (there are no mailboxes below this one). Calling imap_createmailbox() will not work on this mailbox. // * LATT_NOSELECT - This is only a container, not a mailbox - you cannot open it. // * LATT_MARKED - This mailbox is marked. This means that it may contain new messages since the last time it was checked. Not provided by all IMAP servers. // * LATT_UNMARKED - This mailbox is not marked, does not contain new messages. If either MARKED or UNMARKED is provided, you can assume the IMAP server supports this feature for this mailbox. // * LATT_REFERRAL - This container has a referral to a remote mailbox. // * LATT_HASCHILDREN - This mailbox has selectable inferiors. // * LATT_HASNOCHILDREN - This mailbox has no selectable inferiors. // The function returns false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_getmailboxes() example // [php] // $mbox = imap_open("{imap.example.org}", "username", "password", OP_HALFOPEN) // or die("can't connect: " . imap_last_error()); // // $list = imap_getmailboxes($mbox, "{imap.example.org}", "*"); // if (is_array($list)) { // foreach ($list as $key => $val) { // echo "($key) "; // echo imap_utf7_decode($val->name) . ","; // echo "'" . $val->delimiter . "',"; // echo $val->attributes . "
\n"; // } // } else { // echo "imap_getmailboxes failed: " . imap_last_error() . "\n"; // } // // imap_close($mbox); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-getmailboxes.php // ========== IMAP_GETMAILBOXES - END // SYNTAX: // array|false imap_getmailboxes(IMAP\Connection $imap, string $reference, string $pattern) return $return_imap_getmailboxes; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_GETMAILBOXES // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_GETSUBSCRIBED // ============================== PUBLIC // ============================== ABOUT // List all the subscribed mailboxes. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_getsubscribed() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_getsubscribed($imap, $reference, $pattern) { $return_imap_getsubscribed = false; // ========== IMAP_GETSUBSCRIBED - BEGIN // ===== ABOUT // List all the subscribed mailboxes // ===== DESCRIPTION // Gets information about the subscribed mailboxes. // Identical to imap_getmailboxes(), except that it only returns mailboxes that the user is subscribed to. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_getsubscribed(IMAP\Connection $imap, string $reference, string $pattern): array|false // ===== CODE $return_imap_getsubscribed = imap_getsubscribed( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $reference, // string reference - reference should normally be just the server specification as described in imap_open() // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. $pattern // string pattern - Specifies where in the mailbox hierarchy to start searching. // There are two special characters you can pass as part of the pattern: '*' and '%'. '*' means to return all mailboxes. If you pass pattern as '*', you will get a list of the entire mailbox hierarchy. '%' means to return the current level only. '%' as the pattern parameter will return only the top level mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory. ); // Return Values // Returns an array of objects containing mailbox information. Each object has the attributes name, specifying the full name of the mailbox; delimiter, which is the hierarchy delimiter for the part of the hierarchy this mailbox is in; and attributes. Attributes is a bitmask that can be tested against: // * LATT_NOINFERIORS - This mailbox has no "children" (there are no mailboxes below this one). // * LATT_NOSELECT - This is only a container, not a mailbox - you cannot open it. // * LATT_MARKED - This mailbox is marked. Only used by UW-IMAPD. // * LATT_UNMARKED - This mailbox is not marked. Only used by UW-IMAPD. // * LATT_REFERRAL - This container has a referral to a remote mailbox. // * LATT_HASCHILDREN - This mailbox has selectable inferiors. // * LATT_HASNOCHILDREN - This mailbox has no selectable inferiors. // The function returns false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-getsubscribed.php // ========== IMAP_GETSUBSCRIBED - END // SYNTAX: // array|false imap_getsubscribed(IMAP\Connection $imap, string $reference, string $pattern) return $return_imap_getsubscribed; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_GETSUBSCRIBED // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_HEADER // ============================== OFFLINE // ============================== ABOUT // Read the header of the message. // // imap_header - Alias of imap_headerinfo(). // // Warning: This alias is REMOVED as of PHP 8.0.0. // ============================== SUPPORT // PHP_4 - PHP_7 // ============================== USING FUNCTIONS (1) // imap_header() - PHP_4, PHP_5, PHP_7 // ============================== CODE /* function php_mail_imap_imap_header($imap, $message_num, $from_length = 0, $subject_length = 0) { $return_imap_header = false; // ========== IMAP_HEADER - BEGIN // ===== ABOUT // imap_header - Alias of imap_headerinfo() // Warning: This alias is REMOVED as of PHP 8.0.0. // ===== DESCRIPTION // This function is an alias of: imap_headerinfo(). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7 // ===== SYNTAX // ===== CODE $return_imap_header = imap_header( $imap, // IMAP\Connection $imap $message_num, // int $message_num $from_length, // int $from_length $subject_length // int $subject_length ); // Return // stdClass|false // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-header.php // ========== IMAP_HEADER - END // ========== IMAP_HEADERINFO - BEGIN // ===== ABOUT // Read the header of the message // ===== DESCRIPTION // Gets information about the given message number by reading its headers. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_headerinfo( // IMAP\Connection $imap, // int $message_num, // int $from_length = 0, // int $subject_length = 0 // ): stdClass|false // ===== CODE // $return_imap_headerinfo = imap_headerinfo( // $imap, // IMAP\Connection imap - An IMAP\Connection instance. // $message_num, // int message_num - The message number // $from_length, // int from_length - Number of characters for the fetchfrom property. Must be greater than or equal to zero. // $subject_length // int subject_length - Number of characters for the fetchsubject property Must be greater than or equal to zero. // defaulthost // ); // Return Values // Returns false on error or, if successful, the information in an object with following properties: // * toaddress - full to: line, up to 1024 characters // * to - an array of objects from the To: line, with the following properties: personal, adl, mailbox, and host // * fromaddress - full from: line, up to 1024 characters // * from - an array of objects from the From: line, with the following properties: personal, adl, mailbox, and host // * ccaddress - full cc: line, up to 1024 characters // * cc - an array of objects from the Cc: line, with the following properties: personal, adl, mailbox, and host // * bccaddress - full bcc: line, up to 1024 characters // * bcc - an array of objects from the Bcc: line, with the following properties: personal, adl, mailbox, and host // * reply_toaddress - full Reply-To: line, up to 1024 characters // * reply_to - an array of objects from the Reply-To: line, with the following properties: personal, adl, mailbox, and host // * senderaddress - full sender: line, up to 1024 characters // * sender - an array of objects from the Sender: line, with the following properties: personal, adl, mailbox, and host // * return_pathaddress - full Return-Path: line, up to 1024 characters // * return_path - an array of objects from the Return-Path: line, with the following properties: personal, adl, mailbox, and host // * remail - // * date - The message date as found in its headers // * Date - Same as date // * subject - The message subject // * Subject - Same as subject // * in_reply_to - // * message_id - // * newsgroups - // * followup_to - // * references - // * 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 // * Flagged - F if flagged, ' ' if not flagged // * Answered - A if answered, ' ' if unanswered // * Deleted - D if deleted, ' ' if not deleted // * Draft - X if draft, ' ' if not draft // * Msgno - The message number // * MailDate - // * Size - The message size // * udate - mail message date in Unix time // * fetchfrom - from line formatted to fit from_length characters // * fetchsubject - subject line formatted to fit subject_length characters // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // 8.0.0 - The unused defaulthost parameter has been removed. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-headerinfo.php // ========== IMAP_HEADERINFO - END // stdClass|false imap_header(IMAP\Connection $imap, int $message_num, int $from_length = 0, int $subject_length = 0) return $return_imap_header; // stdClass|false } */ // ============================== END // PHP_MAIL_IMAP_IMAP_HEADER // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_HEADERINFO // ============================== PUBLIC // ============================== ABOUT // Read the header of the message. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_headerinfo() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_headerinfo($imap, $message_num, $from_length = 0, $subject_length = 0) { $return_imap_headerinfo = false; // ========== IMAP_HEADERINFO - BEGIN // ===== ABOUT // Read the header of the message // ===== DESCRIPTION // Gets information about the given message number by reading its headers. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_headerinfo( // IMAP\Connection $imap, // int $message_num, // int $from_length = 0, // int $subject_length = 0 // ): stdClass|false // ===== CODE $return_imap_headerinfo = imap_headerinfo( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $message_num, // int message_num - The message number $from_length, // int from_length - Number of characters for the fetchfrom property. Must be greater than or equal to zero. $subject_length // int subject_length - Number of characters for the fetchsubject property Must be greater than or equal to zero. // defaulthost ); // Return Values // Returns false on error or, if successful, the information in an object with following properties: // * toaddress - full to: line, up to 1024 characters // * to - an array of objects from the To: line, with the following properties: personal, adl, mailbox, and host // * fromaddress - full from: line, up to 1024 characters // * from - an array of objects from the From: line, with the following properties: personal, adl, mailbox, and host // * ccaddress - full cc: line, up to 1024 characters // * cc - an array of objects from the Cc: line, with the following properties: personal, adl, mailbox, and host // * bccaddress - full bcc: line, up to 1024 characters // * bcc - an array of objects from the Bcc: line, with the following properties: personal, adl, mailbox, and host // * reply_toaddress - full Reply-To: line, up to 1024 characters // * reply_to - an array of objects from the Reply-To: line, with the following properties: personal, adl, mailbox, and host // * senderaddress - full sender: line, up to 1024 characters // * sender - an array of objects from the Sender: line, with the following properties: personal, adl, mailbox, and host // * return_pathaddress - full Return-Path: line, up to 1024 characters // * return_path - an array of objects from the Return-Path: line, with the following properties: personal, adl, mailbox, and host // * remail - // * date - The message date as found in its headers // * Date - Same as date // * subject - The message subject // * Subject - Same as subject // * in_reply_to - // * message_id - // * newsgroups - // * followup_to - // * references - // * 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 // * Flagged - F if flagged, ' ' if not flagged // * Answered - A if answered, ' ' if unanswered // * Deleted - D if deleted, ' ' if not deleted // * Draft - X if draft, ' ' if not draft // * Msgno - The message number // * MailDate - // * Size - The message size // * udate - mail message date in Unix time // * fetchfrom - from line formatted to fit from_length characters // * fetchsubject - subject line formatted to fit subject_length characters // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // 8.0.0 - The unused defaulthost parameter has been removed. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-headerinfo.php // ========== IMAP_HEADERINFO - END // SYNTAX: // stdClass|false imap_headerinfo(IMAP\Connection $imap, int $message_num, int $from_length = 0, int $subject_length = 0) return $return_imap_headerinfo; // stdClass|false } // ============================== END // PHP_MAIL_IMAP_IMAP_HEADERINFO // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_HEADERS // ============================== PUBLIC // ============================== ABOUT // Returns headers for all messages in a mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_headers() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_headers($imap) { $return_imap_headers = false; // ========== IMAP_HEADERS - BEGIN // ===== ABOUT // Returns headers for all messages in a mailbox // ===== DESCRIPTION // Returns headers for all messages in a mailbox. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_headers(IMAP\Connection $imap): array|false // ===== CODE $return_imap_headers = imap_headers( $imap // IMAP\Connection imap - An IMAP\Connection instance. ); // Return Values // Returns an array of string formatted with header info. One element per mail message. Returns false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-headers.php // ========== IMAP_HEADERS - END // SYNTAX: // array|false imap_headers(IMAP\Connection $imap) return $return_imap_headers; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_HEADERS // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_IS_OPEN // ============================== OFFLINE // ============================== ABOUT // Check if the IMAP stream is still valid. // ============================== SUPPORT // PHP_8 // ============================== USING FUNCTIONS (1) // imap_is_open() - PHP_8 >= PHP_8_2_1 // ============================== CODE /* function php_mail_imap_imap_is_open($imap) { $return_imap_is_open = false; // ========== IMAP_IS_OPEN - BEGIN // ===== ABOUT // Check if the IMAP stream is still valid // ===== DESCRIPTION // Check if the IMAP stream is still valid. // ===== SUPPORTED // PHP_8 >= PHP_8_2_1 // ===== SYNTAX // imap_is_open(IMAP\Connection $imap): bool // ===== CODE $return_imap_is_open = imap_is_open( $imap // IMAP\Connection imap - An IMAP\Connection instance. ); // Return Values // Returns true if the stream is still valid, false otherwise. // // [examples] // Examples // [example] // Example #1 imap_is_open() example // [php] // $mbox = imap_open("{imap.example.org:143}INBOX", "username", "password") or die(implode(", ", imap_errors())); // imap_is_open($mbox); // // ... // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-is-open.php // ========== IMAP_IS_OPEN - END // SYNTAX: // bool imap_is_open(IMAP\Connection $imap) return $return_imap_is_open; // bool } */ // ============================== END // PHP_MAIL_IMAP_IMAP_IS_OPEN // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_LAST_ERROR // ============================== PUBLIC // ============================== ABOUT // Gets the last IMAP error that occurred during this page request. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_last_error() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_last_error() { $return_imap_last_error = false; // ========== IMAP_LAST_ERROR - BEGIN // ===== ABOUT // Gets the last IMAP error that occurred during this page request // ===== DESCRIPTION // Gets the full text of the last IMAP error message that occurred on the current page. The error stack is untouched; calling imap_last_error() subsequently, with no intervening errors, will return the same error. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_last_error(): string|false // ===== CODE $return_imap_last_error = imap_last_error( // This function has no parameters. ); // Return Values // Returns the full text of the last IMAP error message that occurred on the current page. Returns false if no error messages are available. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-last-error.php // ========== IMAP_LAST_ERROR - END // SYNTAX: // string|false imap_last_error() return $return_imap_last_error; // string|false } // ============================== END // PHP_MAIL_IMAP_IMAP_LAST_ERROR // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_LIST // ============================== PUBLIC // ============================== ABOUT // Read the list of mailboxes. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_list() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_list($imap, $reference, $pattern) { $return_imap_list = false; // ========== IMAP_LIST - BEGIN // ===== ABOUT // Read the list of mailboxes // ===== DESCRIPTION // Read the list of mailboxes. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_list(IMAP\Connection $imap, string $reference, string $pattern): array|false // ===== CODE $return_imap_list = imap_list( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $reference, // string reference - reference should normally be just the server specification as described in imap_open(). // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. $pattern // string pattern - Specifies where in the mailbox hierarchy to start searching. // There are two special characters you can pass as part of the pattern: '*' and '%'. '*' means to return all mailboxes. If you pass pattern as '*', you will get a list of the entire mailbox hierarchy. '%' means to return the current level only. '%' as the pattern parameter will return only the top level mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory. ); // Return Values // Returns an array containing the names of the mailboxes or false in case of failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_list() example // [php] // $mbox = imap_open("{imap.example.org}", "username", "password", OP_HALFOPEN) // or die("can't connect: " . imap_last_error()); // // $list = imap_list($mbox, "{imap.example.org}", "*"); // if (is_array($list)) { // foreach ($list as $val) { // echo imap_utf7_decode($val) . "\n"; // } // } else { // echo "imap_list failed: " . imap_last_error() . "\n"; // } // // imap_close($mbox); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-list.php // ========== IMAP_LIST - END // SYNTAX: // array|false imap_list(IMAP\Connection $imap, string $reference, string $pattern) return $return_imap_list; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_LIST // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_LISTMAILBOX // ============================== PUBLIC // ============================== ABOUT // Read the list of mailboxes. // // imap_listmailbox - Alias of imap_list(). // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_listmailbox() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_listmailbox($imap, $reference, $pattern) { $return_imap_listmailbox = false; // ========== IMAP_LISTMAILBOX - BEGIN // ===== ABOUT // imap_listmailbox - Alias of imap_list() // ===== DESCRIPTION // This function is an alias of: imap_list(). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // ===== CODE $return_imap_listmailbox = imap_listmailbox( $imap, // IMAP\Connection $imap $reference, // string $reference $pattern // string $pattern ); // Return // array|false // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-listmailbox.php // ========== IMAP_LISTMAILBOX - END // ========== IMAP_LIST - BEGIN // ===== ABOUT // Read the list of mailboxes // ===== DESCRIPTION // Read the list of mailboxes. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_list(IMAP\Connection $imap, string $reference, string $pattern): array|false // ===== CODE // $return_imap_list = imap_list( // $imap, // IMAP\Connection imap - An IMAP\Connection instance. // $reference, // string reference - reference should normally be just the server specification as described in imap_open(). // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. // $pattern // string pattern - Specifies where in the mailbox hierarchy to start searching. // There are two special characters you can pass as part of the pattern: '*' and '%'. '*' means to return all mailboxes. If you pass pattern as '*', you will get a list of the entire mailbox hierarchy. '%' means to return the current level only. '%' as the pattern parameter will return only the top level mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory. // ); // Return Values // Returns an array containing the names of the mailboxes or false in case of failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_list() example // [php] // $mbox = imap_open("{imap.example.org}", "username", "password", OP_HALFOPEN) // or die("can't connect: " . imap_last_error()); // // $list = imap_list($mbox, "{imap.example.org}", "*"); // if (is_array($list)) { // foreach ($list as $val) { // echo imap_utf7_decode($val) . "\n"; // } // } else { // echo "imap_list failed: " . imap_last_error() . "\n"; // } // // imap_close($mbox); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-list.php // ========== IMAP_LIST - END // SYNTAX: // array|false imap_listmailbox(IMAP\Connection $imap, string $reference, string $pattern) return $return_imap_listmailbox; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_LISTMAILBOX // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_LISTSCAN // ============================== PUBLIC // ============================== ABOUT // Returns the list of mailboxes that matches the given text. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_listscan() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_listscan($imap, $reference, $pattern, $content) { $return_imap_listscan = false; // ========== IMAP_LISTSCAN - BEGIN // ===== ABOUT // Returns the list of mailboxes that matches the given text // ===== DESCRIPTION // Returns an array containing the names of the mailboxes that have content in the text of the mailbox. // This function is similar to imap_listmailbox(), but it will additionally check for the presence of the string content inside the mailbox data. // ===== SUPPORTED // imap_listscan( // IMAP\Connection $imap, // string $reference, // string $pattern, // string $content // ): array|false // ===== SYNTAX // PHP_4, PHP_5, PHP_7, PHP_8 // ===== CODE $return_imap_listscan = imap_listscan( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $reference, // string reference - reference should normally be just the server specification as described in imap_open() // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. $pattern, // string pattern - Specifies where in the mailbox hierarchy to start searching. // There are two special characters you can pass as part of the pattern: '*' and '%'. '*' means to return all mailboxes. If you pass pattern as '*', you will get a list of the entire mailbox hierarchy. '%' means to return the current level only. '%' as the pattern parameter will return only the top level mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory. $content // string content - The searched string ); // Return Values // Returns an array containing the names of the mailboxes that have content in the text of the mailbox, or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-listscan.php // ========== IMAP_LISTSCAN - END // SYNTAX: // array|false imap_listscan(IMAP\Connection $imap, string $reference, string $pattern, string $content) return $return_imap_listscan; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_LISTSCAN // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_LISTSUBSCRIBED // ============================== PUBLIC // ============================== ABOUT // List all the subscribed mailboxes. // // imap_listsubscribed - Alias of imap_lsub(). // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_listsubscribed() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_listsubscribed($imap, $reference, $pattern) { $return_imap_listsubscribed = false; // ========== IMAP_LISTSUBSCRIBED - BEGIN // ===== ABOUT // imap_listsubscribed - Alias of imap_lsub() // ===== DESCRIPTION // This function is an alias of: imap_lsub(). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // ===== CODE $return_imap_listsubscribed = imap_listsubscribed( $imap, // IMAP\Connection $imap $reference, // string $reference $pattern // string $pattern ); // Return // array|false // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-listsubscribed.php // ========== IMAP_LISTSUBSCRIBED - END // ========== IMAP_LSUB - BEGIN // ===== ABOUT // List all the subscribed mailboxes // ===== DESCRIPTION // Gets an array of all the mailboxes that you have subscribed. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_lsub(IMAP\Connection $imap, string $reference, string $pattern): array|false // ===== CODE // $return_imap_listsubscribed = imap_lsub( // $imap, // IMAP\Connection imap - An IMAP\Connection instance. // $reference, // string reference - reference should normally be just the server specification as described in imap_open() // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. // $pattern // string pattern - Specifies where in the mailbox hierarchy to start searching. // There are two special characters you can pass as part of the pattern: '*' and '%'. '*' means to return all mailboxes. If you pass pattern as '*', you will get a list of the entire mailbox hierarchy. '%' means to return the current level only. '%' as the pattern parameter will return only the top level mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory. // ); // Return Values // Returns an array of all the subscribed mailboxes, or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-lsub.php // ========== IMAP_LSUB - END // SYNTAX: // array|false imap_listsubscribed(IMAP\Connection $imap, string $reference, string $pattern) return $return_imap_listsubscribed; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_LISTSUBSCRIBED // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_LSUB // ============================== PUBLIC // ============================== ABOUT // List all the subscribed mailboxes. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_lsub() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_lsub($imap, $reference, $pattern) { $return_imap_listsubscribed = false; // ========== IMAP_LSUB - BEGIN // ===== ABOUT // List all the subscribed mailboxes // ===== DESCRIPTION // Gets an array of all the mailboxes that you have subscribed. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_lsub(IMAP\Connection $imap, string $reference, string $pattern): array|false // ===== CODE $return_imap_listsubscribed = imap_lsub( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $reference, // string reference - reference should normally be just the server specification as described in imap_open() // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. $pattern // string pattern - Specifies where in the mailbox hierarchy to start searching. // There are two special characters you can pass as part of the pattern: '*' and '%'. '*' means to return all mailboxes. If you pass pattern as '*', you will get a list of the entire mailbox hierarchy. '%' means to return the current level only. '%' as the pattern parameter will return only the top level mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory. ); // Return Values // Returns an array of all the subscribed mailboxes, or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-lsub.php // ========== IMAP_LSUB - END // SYNTAX: // array|false imap_lsub(IMAP\Connection $imap, string $reference, string $pattern) return $return_imap_listsubscribed; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_LSUB // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_MAIL_COMPOSE // ============================== PUBLIC // ============================== ABOUT // Create a MIME message based on given envelope and body sections. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_mail_compose() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_mail_compose($envelope, $bodies) { $return_imap_mail_compose = false; // ========== IMAP_MAIL_COMPOSE - BEGIN // ===== ABOUT // Create a MIME message based on given envelope and body sections // ===== DESCRIPTION // Create a MIME message based on the given envelope and bodies sections. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_mail_compose(array $envelope, array $bodies): string|false // ===== CODE $return_imap_mail_compose = imap_mail_compose( $envelope, // array envelope - An associative array of header fields. Valid keys are: "remail", "return_path", "date", "from", "reply_to", "in_reply_to", "subject", "to", "cc", "bcc" and "message_id", which set the respective message headers to the given string. To set additional headers, the key "custom_headers" is supported, which expects an array of those headers, e.g. ["User-Agent: My Mail Client"]. $bodies // array bodies - An indexed array of bodies. The first body is the main body of the message; only if it has a type of TYPEMULTIPART, further bodies are processed; these bodies constitute the bodies of the parts. // Body Array Structure // Key (Type) - Description // type (int) - The MIME type. One of TYPETEXT (default), TYPEMULTIPART, TYPEMESSAGE, TYPEAPPLICATION, TYPEAUDIO, TYPEIMAGE, TYPEMODEL or TYPEOTHER. // encoding (int) - The Content-Transfer-Encoding. One of ENC7BIT (default), ENC8BIT, ENCBINARY, ENCBASE64, ENCQUOTEDPRINTABLE or ENCOTHER. // charset (string) - The charset parameter of the MIME type. // type.parameters (array) - An associative array of Content-Type parameter names and their values. // subtype (string) - The MIME subtype, e.g. 'jpeg' for TYPEIMAGE. // id (string) - The Content-ID. // description (string) - The Content-Description. // disposition.type (string) - The Content-Disposition, e.g. 'attachment'. // disposition (array) - An associative array of Content-Disposition parameter names and values. // contents.data (string) - The payload. // lines (int) - The size of the payload in lines. // bytes (int) - The size of the payload in bytes. // md5 (string) - The MD5 checksum of the payload. ); // Return Values // Returns the MIME message as string, or false on failure. // // [examples] // Examples // [example] // Example #1 imap_mail_compose() example // [php] // // $envelope["from"]= "joe@example.com"; // $envelope["to"] = "foo@example.com"; // $envelope["cc"] = "bar@example.com"; // // $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)); // // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-mail-compose.php // ========== IMAP_MAIL_COMPOSE - END // SYNTAX: // string|false imap_mail_compose(array $envelope, array $bodies) return $return_imap_mail_compose; // string|false } // ============================== END // PHP_MAIL_IMAP_IMAP_MAIL_COMPOSE // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_MAIL_COPY // ============================== PUBLIC // ============================== ABOUT // Copy specified messages to a mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_mail_copy() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_mail_copy($imap, $message_nums, $mailbox, $flags = 0) { $return_imap_mail_copy = false; // ========== IMAP_MAIL_COPY - BEGIN // ===== ABOUT // Copy specified messages to a mailbox // ===== DESCRIPTION // Copies mail messages specified by message_nums to specified mailbox. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_mail_copy( // IMAP\Connection $imap, // string $message_nums, // string $mailbox, // int $flags = 0 // ): bool // ===== CODE $return_imap_mail_copy = imap_mail_copy( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $message_nums, // string message_nums - message_nums is a range not just message numbers (as described in > RFC2060). $mailbox, // string mailbox - The mailbox name, see imap_open() for more information // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. $flags // int flags - flags is a bitmask of one or more of // * CP_UID - the sequence numbers contain UIDS // * CP_MOVE - Delete the messages from the current mailbox after copying. If this flag is set, the function behaves identically to imap_mail_move(). ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-mail-copy.php // ========== IMAP_MAIL_COPY - END // SYNTAX: // bool imap_mail_copy(IMAP\Connection $imap, string $message_nums, string $mailbox, int $flags = 0) return $return_imap_mail_copy; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_MAIL_COPY // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_MAIL_MOVE // ============================== PUBLIC // ============================== ABOUT // Move specified messages to a mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_mail_move() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_mail_move($imap, $message_nums, $mailbox, $flags = 0) { $return_imap_mail_move = false; // ========== IMAP_MAIL_MOVE - BEGIN // ===== ABOUT // Move specified messages to a mailbox // ===== DESCRIPTION // Moves mail messages specified by message_nums to the specified mailbox. Note that the mail messages are actually copied to the mailbox, and the original messages are flagged for deletion. That implies that the messages in mailbox are assigned new UIDs. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_mail_move( // IMAP\Connection $imap, // string $message_nums, // string $mailbox, // int $flags = 0 // ): bool // ===== CODE $return_imap_mail_move = imap_mail_move( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $message_nums, // string message_nums - message_nums is a range not just message numbers (as described in > RFC2060). $mailbox, // string mailbox - The mailbox name, see imap_open() for more information // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. $flags // int flags - flags is a bitmask and may contain the single option: // * CP_UID - the sequence numbers contain UIDS ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // Notes // Note: imap_mail_move() will flag the original mail with a delete flag, to successfully delete it a call to the imap_expunge() function must be made. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-mail-move.php // ========== IMAP_MAIL_MOVE - END // SYNTAX: // bool imap_mail_move(IMAP\Connection $imap, string $message_nums, string $mailbox, int $flags = 0) return $return_imap_mail_move; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_MAIL_MOVE // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_MAIL // ============================== PUBLIC // ============================== ABOUT // Send an email message. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_mail() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_mail($to, $subject, $message, $additional_headers = null, $cc = null, $bcc = null, $return_path = null) { $return_imap_mail = false; // ========== IMAP_MAIL - BEGIN // ===== ABOUT // Send an email message // ===== DESCRIPTION // This function allows sending of emails with correct handling of Cc and Bcc receivers. // The parameters to, cc and bcc are all strings and are all parsed as > RFC822 address lists. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_mail( // string $to, // string $subject, // string $message, // ?string $additional_headers = null, // ?string $cc = null, // ?string $bcc = null, // ?string $return_path = null // ): bool // ===== CODE $return_imap_mail = imap_mail( $to, // string to - The receiver $subject, // string subject - The mail subject $message, // string message - The mail body, see imap_mail_compose() $additional_headers, // string additional_headers - As string with additional headers to be set on the mail $cc, // string cc $bcc, // string bcc - The receivers specified in bcc will get the mail, but are excluded from the headers. $return_path // string return_path - Use this parameter to specify return path upon mail delivery failure. This is useful when using PHP as a mail client for multiple users. ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.0.0 - additional_headers, cc, bcc, and return_path are now nullable. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-mail.php // ========== IMAP_MAIL - END // SYNTAX: // bool imap_mail(string $to, string $subject, string $message, string $additional_headers = null, string $cc = null, string $bcc = null, string $return_path = null) return $return_imap_mail; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_MAIL // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_MAILBOXMSGINFO // ============================== PUBLIC // ============================== ABOUT // Get information about the current mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_mailboxmsginfo() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_mailboxmsginfo($imap) { $return_imap_mailboxmsginfo = null; // ========== IMAP_MAILBOXMSGINFO - BEGIN // ===== ABOUT // Get information about the current mailbox // ===== DESCRIPTION // Checks the current mailbox status on the server. It is similar to imap_status(), but will additionally sum up the size of all messages in the mailbox, which will take some additional time to execute. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_mailboxmsginfo(IMAP\Connection $imap): stdClass // ===== CODE $return_imap_mailboxmsginfo = imap_mailboxmsginfo( $imap // IMAP\Connection imap - An IMAP\Connection instance. ); // Return Values // Returns the information in an object with following properties: // Mailbox properties // Date - date of last change (current datetime) // Driver - driver // Mailbox - name of the mailbox // Nmsgs - number of messages // Recent - number of recent messages // Unread - number of unread messages // Deleted - number of deleted messages // Size - mailbox size // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_mailboxmsginfo() example // [php] // // $mbox = imap_open("{imap.example.org}INBOX", "username", "password") // or die("can't connect: " . imap_last_error()); // // $check = imap_mailboxmsginfo($mbox); // // if ($check) { // echo "Date: " . $check->Date . "
\n" ; // echo "Driver: " . $check->Driver . "
\n" ; // echo "Mailbox: " . $check->Mailbox . "
\n" ; // echo "Messages: " . $check->Nmsgs . "
\n" ; // echo "Recent: " . $check->Recent . "
\n" ; // echo "Unread: " . $check->Unread . "
\n" ; // echo "Deleted: " . $check->Deleted . "
\n" ; // echo "Size: " . $check->Size . "
\n" ; // } else { // echo "imap_mailboxmsginfo() failed: " . imap_last_error() . "
\n"; // } // // imap_close($mbox); // // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-mailboxmsginfo.php // ========== IMAP_MAILBOXMSGINFO - END // SYNTAX: // stdClass imap_mailboxmsginfo(IMAP\Connection $imap) return $return_imap_mailboxmsginfo; // stdClass } // ============================== END // PHP_MAIL_IMAP_IMAP_MAILBOXMSGINFO // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_MIME_HEADER_DECODE // ============================== PUBLIC // ============================== ABOUT // Decode MIME header elements. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_mime_header_decode() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_mime_header_decode($string) { $return_imap_mime_header_decode = false; // ========== IMAP_MIME_HEADER_DECODE - BEGIN // ===== ABOUT // Decode MIME header elements // ===== DESCRIPTION // Decodes MIME message header extensions that are non ASCII text (see > RFC2047). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_mime_header_decode(string $string): array|false // ===== CODE $return_imap_mime_header_decode = imap_mime_header_decode( $string // string string - The MIME text ); // Return Values // The decoded elements are returned in an array of objects, where each object has two properties, charset and 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. // The function returns false on failure. // // [examples] // Examples // [example] // Example #1 imap_mime_header_decode() example // [php] // $text = "=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= "; // // $elements = imap_mime_header_decode($text); // for ($i=0; $icharset}\n"; // echo "Text: {$elements[$i]->text}\n\n"; // } // [/php] // The above example will output: // [result] // Charset: ISO-8859-1 // Text: Keld Jørn Simonsen // // Charset: default // Text: // [/result] // 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. // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-mime-header-decode.php // ========== IMAP_MIME_HEADER_DECODE - END // SYNTAX: // array|false imap_mime_header_decode(string $string) return $return_imap_mime_header_decode; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_MIME_HEADER_DECODE // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_MSGNO // ============================== PUBLIC // ============================== ABOUT // Gets the message sequence number for the given UID. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_msgno() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_msgno($imap, $message_uid) { $return_imap_msgno = 0; // ========== IMAP_MSGNO - BEGIN // ===== ABOUT // Gets the message sequence number for the given UID // ===== DESCRIPTION // Returns the message sequence number for the given message_uid. // This function is the inverse of imap_uid(). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_msgno(IMAP\Connection $imap, int $message_uid): int // ===== CODE $return_imap_msgno = imap_msgno( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $message_uid // int message_uid - The message UID ); // Return Values // Returns the message sequence number for the given message_uid. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-msgno.php // ========== IMAP_MSGNO - END // SYNTAX: // int imap_msgno(IMAP\Connection $imap, int $message_uid) return $return_imap_msgno; // int } // ============================== END // PHP_MAIL_IMAP_IMAP_MSGNO // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_MUTF7_TO_UTF8 // ============================== OFFLINE // ============================== ABOUT // Decode a modified UTF-7 string to UTF-8. // ============================== SUPPORT // PHP_5 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_mutf7_to_utf8() - PHP_5 >= PHP_5_3_0, PHP_7, PHP_8 // ============================== CODE /* function php_mail_imap_imap_mutf7_to_utf8($string) { $return_imap_mutf7_to_utf8 = false; // ========== IMAP_MUTF7_TO_UTF8 - BEGIN // ===== ABOUT // Decode a modified UTF-7 string to UTF-8 // ===== DESCRIPTION // Decode a modified UTF-7 (as specified in RFC 2060, section 5.1.3) string to UTF-8. // Note: This function is only available, if libcclient exports utf8_to_mutf7(). // ===== SUPPORTED // PHP_5 >= PHP_5_3_0, PHP_7, PHP_8 // ===== SYNTAX // imap_mutf7_to_utf8(string $string): string|false // ===== CODE $return_imap_mutf7_to_utf8 = imap_mutf7_to_utf8( $string // string string - A string encoded in modified UTF-7. ); // Return Values // Returns string converted to UTF-8, or false on failure. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-mutf7-to-utf8.php // ========== IMAP_MUTF7_TO_UTF8 - END // SYNTAX: // string|false imap_mutf7_to_utf8(string $string) return $return_imap_mutf7_to_utf8; // string|false } */ // ============================== END // PHP_MAIL_IMAP_IMAP_MUTF7_TO_UTF8 // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_NUM_MSG // ============================== PUBLIC // ============================== ABOUT // Gets the number of messages in the current mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_num_msg() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_num_msg($imap) { $return_imap_num_msg = false; // ========== IMAP_NUM_MSG - BEGIN // ===== ABOUT // Gets the number of messages in the current mailbox // ===== DESCRIPTION // Gets the number of messages in the current mailbox. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_num_msg(IMAP\Connection $imap): int|false // ===== CODE $return_imap_num_msg = imap_num_msg( $imap // IMAP\Connection imap - An IMAP\Connection instance. ); // Return Values // Return the number of messages in the current mailbox, as an integer, or false on error. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-08) // URL: https://www.php.net/manual/en/function.imap-num-msg.php // ========== IMAP_NUM_MSG - END // SYNTAX: // int|false imap_num_msg(IMAP\Connection $imap) return $return_imap_num_msg; // int|false } // ============================== END // PHP_MAIL_IMAP_IMAP_NUM_MSG // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_NUM_RECENT // ============================== PUBLIC // ============================== ABOUT // Gets the number of recent messages in current mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_num_recent() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_num_recent($imap) { $return_imap_num_recent = 0; // ========== IMAP_NUM_RECENT - BEGIN // ===== ABOUT // Gets the number of recent messages in current mailbox // ===== DESCRIPTION // Gets the number of recent messages in the current mailbox. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_num_recent(IMAP\Connection $imap): int // ===== CODE $return_imap_num_recent = imap_num_recent( $imap // IMAP\Connection imap - An IMAP\Connection instance. ); // Return Values // Returns the number of recent messages in the current mailbox, as an integer. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-08) // URL: https://www.php.net/manual/en/function.imap-num-recent.php // ========== IMAP_NUM_RECENT - END // SYNTAX: // int imap_num_recent(IMAP\Connection $imap) return $return_imap_num_recent; // int } // ============================== END // PHP_MAIL_IMAP_IMAP_NUM_RECENT // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_OPEN // ============================== PUBLIC // ============================== ABOUT // Open an IMAP stream to a mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_open() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_open($mailbox, $user, $password, $flags = 0, $retries = 0, $options = array()) { $return_imap_open = false; // ========== IMAP_OPEN - BEGIN // ===== ABOUT // Open an IMAP stream to a mailbox // ===== DESCRIPTION // Opens an IMAP stream to a mailbox. // This function can also be used to open streams to POP3 and NNTP servers, but some functions and features are only available on IMAP servers. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_open( // string $mailbox, // string $user, // string $password, // int $flags = 0, // int $retries = 0, // array $options = [] // ): IMAP\Connection|false // ===== CODE $return_imap_open = imap_open( $mailbox, // string mailbox - A mailbox name consists of a server and a mailbox path on this server. The special name INBOX stands for the current users personal mailbox. Mailbox names that contain international characters besides those in the printable ASCII space have to be encoded with imap_utf7_encode(). // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. // The server part, which is enclosed in '{' and '}', consists of the servers name or ip address, an optional port (prefixed by ':'), and an optional protocol specification (prefixed by '/'). // The server part is mandatory in all mailbox parameters. // All names which start with { are remote names, and are in the form "{" remote_system_name [":" port] [flags] "}" [mailbox_name] where: // * remote_system_name - Internet domain name or bracketed IP address of server. // * port - optional TCP port number, default is the default port for that service // * flags - optional flags, see following table. // * mailbox_name - remote mailbox name, default is INBOX // Optional flags for names // Flag - Description // /service=service - mailbox access service, default is "imap" // /user=user - remote user name for login on the server // /authuser=user - remote authentication user; if specified this is the user name whose password is used (e.g. administrator) // /anonymous - remote access as anonymous user // /debug - record protocol telemetry in application's debug log // /secure - do not transmit a plaintext password over the network // /imap, /imap2, /imap2bis, /imap4, /imap4rev1 - equivalent to /service=imap // /pop3 - equivalent to /service=pop3 // /nntp - equivalent to /service=nntp // /norsh - do not use rsh or ssh to establish a preauthenticated IMAP session // /ssl - use the Secure Socket Layer to encrypt the session // /validate-cert - validate certificates from TLS/SSL server (this is the default behavior) // /novalidate-cert - do not validate certificates from TLS/SSL server, needed if server uses self-signed certificates // /tls - force use of start-TLS to encrypt the session, and reject connection to servers that do not support it // /notls - do not do start-TLS to encrypt the session, even with servers that support it // /readonly - request read-only mailbox open (IMAP only; ignored on NNTP, and an error with SMTP and POP3) $user, // string user - The user name $password, // string password - The password associated with the user $flags, // int flags - The flags are a bit mask with one or more of the following: // * OP_READONLY - Open mailbox read-only // * OP_ANONYMOUS - Don't use or update a .newsrc for news (NNTP only) // * OP_HALFOPEN - For IMAP and NNTP names, open a connection but don't open a mailbox. // * CL_EXPUNGE - Expunge mailbox automatically upon mailbox close (see also imap_delete() and imap_expunge()) // * OP_DEBUG - Debug protocol negotiations // * OP_SHORTCACHE - Short (elt-only) caching // * OP_SILENT - Don't pass up events (internal use) // * OP_PROTOTYPE - Return driver prototype // * OP_SECURE - Don't do non-secure authentication $retries, // int retries - Number of maximum connect attempts $options // array options - Connection parameters, the following (string) keys maybe used to set one or more connection parameters: // * DISABLE_AUTHENTICATOR - Disable authentication properties ); // Return Values // Returns an IMAP\Connection instance on success, or false on failure. // // Changelog // Version - Description // 8.1.0 - Returns an IMAP\Connection instance now; previously, a resource was returned. // // [examples] // Examples // [example] // Example #1 Different use of imap_open() // [php] // // To connect to an IMAP server running on port 143 on the local machine, // // do the following: // $mbox = imap_open("{localhost:143}INBOX", "user_id", "password"); // // // To connect to a POP3 server on port 110 on the local server, use: // $mbox = imap_open ("{localhost:110/pop3}INBOX", "user_id", "password"); // // // To connect to an SSL IMAP or POP3 server, add /ssl after the protocol // // specification: // $mbox = imap_open ("{localhost:993/imap/ssl}INBOX", "user_id", "password"); // // // To connect to an SSL IMAP or POP3 server with a self-signed certificate, // // add /ssl/novalidate-cert after the protocol specification: // $mbox = imap_open ("{localhost:995/pop3/ssl/novalidate-cert}", "user_id", "password"); // // // To connect to an NNTP server on port 119 on the local server, use: // $nntp = imap_open ("{localhost:119/nntp}comp.test", "", ""); // // To connect to a remote server replace "localhost" with the name or the // // IP address of the server you want to connect to. // [/php] // [/example] // [example] // Example #2 imap_open() example // [php] // $mbox = imap_open("{imap.example.org:143}", "username", "password"); // // echo "

Mailboxes

\n"; // $folders = imap_listmailbox($mbox, "{imap.example.org:143}", "*"); // // if ($folders == false) { // echo "Call failed
\n"; // } else { // foreach ($folders as $val) { // echo $val . "
\n"; // } // } // // echo "

Headers in INBOX

\n"; // $headers = imap_headers($mbox); // // if ($headers == false) { // echo "Call failed
\n"; // } else { // foreach ($headers as $val) { // echo $val . "
\n"; // } // } // // imap_close($mbox); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-open.php // ========== IMAP_OPEN - END // SYNTAX: // IMAP\Connection|false imap_open(string $mailbox, string $user, string $password, int $flags = 0, int $retries = 0, array $options = array()) return $return_imap_open; // IMAP\Connection|false } // ============================== END // PHP_MAIL_IMAP_IMAP_OPEN // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_PING // ============================== PUBLIC // ============================== ABOUT // Check if the IMAP stream is still active. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_ping() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_ping($imap) { $return_imap_ping = false; // ========== IMAP_PING - BEGIN // ===== ABOUT // Check if the IMAP stream is still active // ===== DESCRIPTION // imap_ping() pings the stream to see if it's 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. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_ping(IMAP\Connection $imap): bool // ===== CODE $return_imap_ping = imap_ping( $imap // IMAP\Connection imap - An IMAP\Connection instance. ); // Return Values // Returns true if the stream is still alive, false otherwise. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_ping() Example // [php] // // $imap = imap_open("{imap.example.org}", "mailadmin", "password"); // // // after some sleeping // if (!imap_ping($imap)) { // // do some stuff to reconnect // } // // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-ping.php // ========== IMAP_PING - END // SYNTAX: // bool imap_ping(IMAP\Connection $imap) return $return_imap_ping; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_PING // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_QPRINT // ============================== PUBLIC // ============================== ABOUT // Convert a quoted-printable string to an 8 bit string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_qprint() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_qprint($string) { $return_imap_qprint = false; // ========== IMAP_QPRINT - BEGIN // ===== ABOUT // Convert a quoted-printable string to an 8 bit string // ===== DESCRIPTION // Convert a quoted-printable string to an 8 bit string according to > RFC2045, section 6.7. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_qprint(string $string): string|false // ===== CODE $return_imap_qprint = imap_qprint( $string // string string - A quoted-printable string ); // Return Values // Returns an 8 bits string, or false on failure. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-qprint.php // ========== IMAP_QPRINT - END // SYNTAX: // string|false imap_qprint(string $string) return $return_imap_qprint; // string|false } // ============================== END // PHP_MAIL_IMAP_IMAP_QPRINT // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_RENAME // ============================== PUBLIC // ============================== ABOUT // imap_rename - Alias of imap_renamemailbox(). // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_rename() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_rename($imap, $from, $to) { $return_imap_rename = false; // ========== IMAP_RENAME - BEGIN // ===== ABOUT // imap_rename - Alias of imap_renamemailbox() // ===== DESCRIPTION // This function is an alias of: imap_renamemailbox(). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // ===== CODE $return_imap_rename = imap_rename( $imap, // IMAP\Connection $imap $from, // string $from $to // string $to ); // Return // bool // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-rename.php // ========== IMAP_RENAME - END // ========== IMAP_RENAMEMAILBOX - BEGIN // ===== ABOUT // Rename an old mailbox to new mailbox // ===== DESCRIPTION // This function renames on old mailbox to new mailbox (see imap_open() for the format of mbox names). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_renamemailbox(IMAP\Connection $imap, string $from, string $to): bool // ===== CODE // $return_imap_renamemailbox = imap_renamemailbox( // $imap, // IMAP\Connection imap - An IMAP\Connection instance. // $from, // string from - The old mailbox name, see imap_open() for more information // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. // $to // string to - The new mailbox name, see imap_open() for more information // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. // ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-renamemailbox.php // ========== IMAP_RENAMEMAILBOX - END // SYNTAX: // bool imap_rename(IMAP\Connection $imap, string $from, string $to) return $return_imap_rename; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_RENAME // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_RENAMEMAILBOX // ============================== PUBLIC // ============================== ABOUT // Rename an old mailbox to new mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_renamemailbox() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_renamemailbox($imap, $from, $to) { $return_imap_renamemailbox = false; // ========== IMAP_RENAMEMAILBOX - BEGIN // ===== ABOUT // Rename an old mailbox to new mailbox // ===== DESCRIPTION // This function renames on old mailbox to new mailbox (see imap_open() for the format of mbox names). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_renamemailbox(IMAP\Connection $imap, string $from, string $to): bool // ===== CODE $return_imap_renamemailbox = imap_renamemailbox( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $from, // string from - The old mailbox name, see imap_open() for more information // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. $to // string to - The new mailbox name, see imap_open() for more information // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-renamemailbox.php // ========== IMAP_RENAMEMAILBOX - END // SYNTAX: // bool imap_renamemailbox(IMAP\Connection $imap, string $from, string $to) return $return_imap_renamemailbox; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_RENAMEMAILBOX // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_REOPEN // ============================== PUBLIC // ============================== ABOUT // Reopen IMAP stream to new mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_reopen() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_reopen($imap, $mailbox, $flags = 0, $retries = 0) { $return_imap_reopen = false; // ========== IMAP_REOPEN - BEGIN // ===== ABOUT // Reopen IMAP stream to new mailbox // ===== DESCRIPTION // Reopens the specified stream to a new mailbox on an IMAP or NNTP server. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_reopen( // IMAP\Connection $imap, // string $mailbox, // int $flags = 0, // int $retries = 0 // ): bool // ===== CODE $return_imap_reopen = imap_reopen( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $mailbox, // string mailbox - The mailbox name, see imap_open() for more information // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. $flags, // int flags - The flags are a bit mask with one or more of the following: // * OP_READONLY - Open mailbox read-only // * OP_ANONYMOUS - Don't use or update a .newsrc for news (NNTP only) // * OP_HALFOPEN - For IMAP and NNTP names, open a connection but don't open a mailbox. // * OP_EXPUNGE - Silently expunge recycle stream // * CL_EXPUNGE - Expunge mailbox automatically upon mailbox close (see also imap_delete() and imap_expunge()) $retries // int retries - Number of maximum connect attempts ); // Return Values // Returns true if the stream is reopened, false otherwise. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_reopen() example // [php] // $mbox = imap_open("{imap.example.org:143}INBOX", "username", "password") or die(implode(", ", imap_errors())); // // ... // imap_reopen($mbox, "{imap.example.org:143}INBOX.Sent") or die(implode(", ", imap_errors())); // // .. // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-reopen.php // ========== IMAP_REOPEN - END // SYNTAX: // bool imap_reopen(IMAP\Connection $imap, string $mailbox, int $flags = 0, int $retries = 0) return $return_imap_reopen; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_REOPEN // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_RFC822_PARSE_ADRLIST // ============================== PUBLIC // ============================== ABOUT // Parses an address string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_rfc822_parse_adrlist() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_rfc822_parse_adrlist($string, $default_hostname) { $return_imap_rfc822_parse_adrlist = null; // ========== IMAP_RFC822_PARSE_ADRLIST - BEGIN // ===== ABOUT // Parses an address string // ===== DESCRIPTION // Parses the address string as defined in > RFC2822 and for each address. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_rfc822_parse_adrlist(string $string, string $default_hostname): array // ===== CODE $return_imap_rfc822_parse_adrlist = imap_rfc822_parse_adrlist( $string, // string string - A string containing addresses $default_hostname // string default_hostname - The default host name ); // Return Values // Returns an array of objects. The objects properties are: // * mailbox - the mailbox name (username) // * host - the host name // * personal - the personal name // * adl - at domain source route // // [examples] // Examples // [example] // Example #1 imap_rfc822_parse_adrlist() example // [php] // // $address_string = "Joe Doe , postmaster@example.com, root"; // $address_array = imap_rfc822_parse_adrlist($address_string, "example.com"); // if (!is_array($address_array) || count($address_array) < 1) { // die("something is wrong\n"); // } // // foreach ($address_array as $id => $val) { // echo "# $id\n"; // echo " mailbox : " . $val->mailbox . "\n"; // echo " host : " . $val->host . "\n"; // echo " personal: " . $val->personal . "\n"; // echo " adl : " . $val->adl . "\n"; // } // [/php] // The above example will output: // [result] // # 0 // mailbox : doe // host : example.com // personal: Joe Doe // adl : // # 1 // mailbox : postmaster // host : example.com // personal: // adl : // # 2 // mailbox : root // host : example.com // personal: // adl : // // [/result] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-rfc822-parse-adrlist.php // ========== IMAP_RFC822_PARSE_ADRLIST - END // SYNTAX: // array imap_rfc822_parse_adrlist(string $string, string $default_hostname) return $return_imap_rfc822_parse_adrlist; // array } // ============================== END // PHP_MAIL_IMAP_IMAP_RFC822_PARSE_ADRLIST // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_RFC822_PARSE_HEADERS // ============================== PUBLIC // ============================== ABOUT // Parse mail headers from a string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_rfc822_parse_headers() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_rfc822_parse_headers($headers, $default_hostname = "UNKNOWN") { $return_imap_rfc822_parse_headers = null; // ========== IMAP_RFC822_PARSE_HEADERS - BEGIN // ===== ABOUT // Parse mail headers from a string // ===== DESCRIPTION // Gets an object of various header elements, similar to imap_header(). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_rfc822_parse_headers(string $headers, string $default_hostname = "UNKNOWN"): stdClass // ===== CODE $return_imap_rfc822_parse_headers = imap_rfc822_parse_headers( $headers, // string headers - The parsed headers data $default_hostname // string default_hostname - The default host name ); // Return Values // Returns an object similar to the one returned by imap_header(), except for the flags and other properties that come from the IMAP server. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-rfc822-parse-headers.php // ========== IMAP_RFC822_PARSE_HEADERS - END // SYNTAX: // stdClass imap_rfc822_parse_headers(string $headers, string $default_hostname = "UNKNOWN") return $return_imap_rfc822_parse_headers; // stdClass } // ============================== END // PHP_MAIL_IMAP_IMAP_RFC822_PARSE_HEADERS // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_RFC822_WRITE_ADDRESS // ============================== PUBLIC // ============================== ABOUT // Returns a properly formatted email address given the mailbox, host, and personal info. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_rfc822_write_address() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_rfc822_write_address($mailbox, $hostname, $personal) { $return_imap_rfc822_write_address = false; // ========== IMAP_RFC822_WRITE_ADDRESS - BEGIN // ===== ABOUT // Returns a properly formatted email address given the mailbox, host, and personal info // ===== DESCRIPTION // Returns a properly formatted email address as defined in > RFC2822 given the needed information. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_rfc822_write_address(string $mailbox, string $hostname, string $personal): string|false // ===== CODE $return_imap_rfc822_write_address = imap_rfc822_write_address( $mailbox, // string mailbox - The mailbox name, see imap_open() for more information // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. $hostname, // string hostname - The email host part $personal // string personal - The name of the account owner ); // Return Values // Returns a string properly formatted email address as defined in > RFC2822, or false on failure. // // [examples] // Examples // [example] // Example #1 imap_rfc822_write_address() example // [php] // echo imap_rfc822_write_address("hartmut", "example.com", "Hartmut Holzgraefe"); // [/php] // The above example will output: // [result] // Hartmut Holzgraefe // [/result] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-rfc822-write-address.php // ========== IMAP_RFC822_WRITE_ADDRESS - END // SYNTAX: // string|false imap_rfc822_write_address(string $mailbox, string $hostname, string $personal) return $return_imap_rfc822_write_address; // string|false } // ============================== END // PHP_MAIL_IMAP_IMAP_RFC822_WRITE_ADDRESS // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_SAVEBODY // ============================== OFFLINE // ============================== ABOUT // Save a specific body section to a file. // ============================== SUPPORT // PHP_5 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_savebody() - PHP_5 >= PHP_5_1_3, PHP_7, PHP_8 // ============================== CODE /* function php_mail_imap_imap_savebody($imap, $file, $message_num, $section = "", $flags = 0) { $return_imap_savebody = false; // ========== IMAP_SAVEBODY - BEGIN // ===== ABOUT // Save a specific body section to a file // ===== DESCRIPTION // Saves a part or the whole body of the specified message. // ===== SUPPORTED // PHP_5 >= PHP_5_1_3, PHP_7, PHP_8 // ===== SYNTAX // imap_savebody( // IMAP\Connection $imap, // resource|string|int $file, // int $message_num, // string $section = "", // int $flags = 0 // ): bool // ===== CODE $return_imap_savebody = imap_savebody( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $file, // resource|string|int file - The path to the saved file as a string, or a valid file descriptor returned by fopen(). $message_num, // int message_num - The message number $section, // string section - The part number. It is a string of integers delimited by period which index into a body part list as per the IMAP4 specification $flags // int flags - A bitmask with one or more of the following: // * FT_UID - The message_num is a UID // * FT_PEEK - Do not set the \Seen flag if not already set // * FT_INTERNAL - The return string is in internal format, will not canonicalize to CRLF. ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-savebody.php // ========== IMAP_SAVEBODY - END // SYNTAX: // bool imap_savebody(IMAP\Connection $imap, resource|string|int $file, int $message_num, string $section = "", int $flags = 0) return $return_imap_savebody; // bool } */ // ============================== END // PHP_MAIL_IMAP_IMAP_SAVEBODY // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_SCAN // ============================== PUBLIC // ============================== ABOUT // Returns the list of mailboxes that matches the given text. // // imap_scan - Alias of imap_listscan(). // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_scan() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_scan($imap, $reference, $pattern, $content) { $return_imap_scan = false; // ========== IMAP_SCAN - BEGIN // ===== ABOUT // imap_scan - Alias of imap_listscan() // ===== DESCRIPTION // This function is an alias of: imap_listscan(). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // ===== CODE $return_imap_scan = imap_scan( $imap, // IMAP\Connection $imap $reference, // string $reference $pattern, // string $pattern $content // string $content ); // Return // array|false // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-scan.php // ========== IMAP_SCAN - END // ========== IMAP_LISTSCAN - BEGIN // ===== ABOUT // Returns the list of mailboxes that matches the given text // ===== DESCRIPTION // Returns an array containing the names of the mailboxes that have content in the text of the mailbox. // This function is similar to imap_listmailbox(), but it will additionally check for the presence of the string content inside the mailbox data. // ===== SUPPORTED // imap_listscan( // IMAP\Connection $imap, // string $reference, // string $pattern, // string $content // ): array|false // ===== SYNTAX // PHP_4, PHP_5, PHP_7, PHP_8 // ===== CODE // $return_imap_listscan = imap_listscan( // $imap, // IMAP\Connection imap - An IMAP\Connection instance. // $reference, // string reference - reference should normally be just the server specification as described in imap_open() // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. // $pattern, // string pattern - Specifies where in the mailbox hierarchy to start searching. // There are two special characters you can pass as part of the pattern: '*' and '%'. '*' means to return all mailboxes. If you pass pattern as '*', you will get a list of the entire mailbox hierarchy. '%' means to return the current level only. '%' as the pattern parameter will return only the top level mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory. // $content // string content - The searched string // ); // Return Values // Returns an array containing the names of the mailboxes that have content in the text of the mailbox, or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-listscan.php // ========== IMAP_LISTSCAN - END // array|false imap_scan(IMAP\Connection $imap, string $reference, string $pattern, string $content) return $return_imap_scan; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_SCAN // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_SCANMAILBOX // ============================== PUBLIC // ============================== ABOUT // Returns the list of mailboxes that matches the given text. // // imap_scanmailbox - Alias of imap_listscan(). // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_scanmailbox() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_scanmailbox($imap, $reference, $pattern, $content) { $return_imap_scanmailbox = false; // ========== IMAP_SCANMAILBOX - BEGIN // ===== ABOUT // imap_scanmailbox - Alias of imap_listscan() // ===== DESCRIPTION // This function is an alias of: imap_listscan(). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // ===== CODE $return_imap_scanmailbox = imap_scanmailbox( $imap, // IMAP\Connection $imap $reference, // string $reference $pattern, // string $pattern $content // string $content ); // Return // array|false // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-scanmailbox.php // ========== IMAP_SCANMAILBOX - END // ========== IMAP_LISTSCAN - BEGIN // ===== ABOUT // Returns the list of mailboxes that matches the given text // ===== DESCRIPTION // Returns an array containing the names of the mailboxes that have content in the text of the mailbox. // This function is similar to imap_listmailbox(), but it will additionally check for the presence of the string content inside the mailbox data. // ===== SUPPORTED // imap_listscan( // IMAP\Connection $imap, // string $reference, // string $pattern, // string $content // ): array|false // ===== SYNTAX // PHP_4, PHP_5, PHP_7, PHP_8 // ===== CODE // $return_imap_listscan = imap_listscan( // $imap, // IMAP\Connection imap - An IMAP\Connection instance. // $reference, // string reference - reference should normally be just the server specification as described in imap_open() // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. // $pattern, // string pattern - Specifies where in the mailbox hierarchy to start searching. // There are two special characters you can pass as part of the pattern: '*' and '%'. '*' means to return all mailboxes. If you pass pattern as '*', you will get a list of the entire mailbox hierarchy. '%' means to return the current level only. '%' as the pattern parameter will return only the top level mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory. // $content // string content - The searched string // ); // Return Values // Returns an array containing the names of the mailboxes that have content in the text of the mailbox, or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-listscan.php // ========== IMAP_LISTSCAN - END // SYNTAX: // array|false imap_scanmailbox(IMAP\Connection $imap, string $reference, string $pattern, string $content) return $return_imap_scanmailbox; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_SCANMAILBOX // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_SEARCH // ============================== PUBLIC // ============================== ABOUT // This function returns an array of messages matching the given search criteria. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_search() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== USING CONSTANTS (1) // SE_FREE - imap_search() // ============================== CODE function php_mail_imap_imap_search($imap, $criteria, $flags = SE_FREE, $charset = "") { $return_imap_search = false; // ========== IMAP_SEARCH - BEGIN // ===== ABOUT // This function returns an array of messages matching the given search criteria // ===== DESCRIPTION // This function performs a search on the mailbox currently opened in the given IMAP stream. // For example, to match all unanswered messages sent by Mom, you'd 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 incomplete or inaccurate (see also > RFC1176, section "tag SEARCH search_criteria"). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_search( // IMAP\Connection $imap, // string $criteria, // int $flags = SE_FREE, // string $charset = "" // ): array|false // ===== CODE $return_imap_search = imap_search( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $criteria, // string criteria - A string, delimited by spaces, in which the following keywords are allowed. Any multi-word arguments (e.g. FROM "joey smith") must be quoted. Results will match all criteria entries. // * ALL - return all messages matching the rest of the criteria // * ANSWERED - match messages with the \\ANSWERED flag set // * BCC "string" - match messages with "string" in the Bcc: field // * BEFORE "date" - match messages with Date: before "date" // * BODY "string" - match messages with "string" in the body of the message // * CC "string" - match messages with "string" in the Cc: field // * DELETED - match deleted messages // * FLAGGED - match messages with the \\FLAGGED (sometimes referred to as Important or Urgent) flag set // * FROM "string" - match messages with "string" in the From: field // * KEYWORD "string" - match messages with "string" as a keyword // * NEW - match new messages // * OLD - match old messages // * ON "date" - match messages with Date: matching "date" // * RECENT - match messages with the \\RECENT flag set // * SEEN - match messages that have been read (the \\SEEN flag is set) // * SINCE "date" - match messages with Date: after "date" // * SUBJECT "string" - match messages with "string" in the Subject: // * TEXT "string" - match messages with text "string" // * TO "string" - match messages with "string" in the To: // * UNANSWERED - match messages that have not been answered // * UNDELETED - match messages that are not deleted // * UNFLAGGED - match messages that are not flagged // * UNKEYWORD "string" - match messages that do not have the keyword "string" // * UNSEEN - match messages which have not been read yet $flags, // int flags - Valid values for flags are SE_UID, which causes the returned array to contain UIDs instead of messages sequence numbers. $charset // string charset - MIME character set to use when searching strings. ); // Return Values // Returns an array of message numbers or UIDs. // Return false if it does not understand the search criteria or no messages have been found. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_search() example // [php] // $imap = imap_open('{imap.example.com:993/imap/ssl}INBOX', 'foo@example.com', 'pass123', OP_READONLY); // // $some = imap_search($imap, 'SUBJECT "HOWTO be Awesome" SINCE "8 August 2008"', SE_UID); // $msgnos = imap_search($imap, 'ALL'); // $uids = imap_search($imap, 'ALL', SE_UID); // // print_r($some); // print_r($msgnos); // print_r($uids); // [/php] // The above example will output something similar to: // [result] // Array // ( // [0] => 4 // [1] => 6 // [2] => 11 // ) // Array // ( // [0] => 1 // [1] => 2 // [2] => 3 // [3] => 4 // [4] => 5 // [5] => 6 // ) // Array // ( // [0] => 1 // [1] => 4 // [2] => 6 // [3] => 8 // [4] => 11 // [5] => 12 // ) // [/result] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-search.php // ========== IMAP_SEARCH - END // SYNTAX: // array|false imap_search(IMAP\Connection $imap, string $criteria, int $flags = SE_FREE, string $charset = "") return $return_imap_search; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_SEARCH // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_SET_QUOTA // ============================== PUBLIC // ============================== ABOUT // Sets a quota for a given mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_set_quota() - PHP_4 >= PHP_4_0_5, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_set_quota($imap, $quota_root, $mailbox_size) { $return_imap_set_quota = false; // ========== IMAP_SET_QUOTA - BEGIN // ===== ABOUT // Sets a quota for a given mailbox // ===== DESCRIPTION // Sets an upper limit quota on a per mailbox basis. // ===== SUPPORTED // PHP_4 >= PHP_4_0_5, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_set_quota(IMAP\Connection $imap, string $quota_root, int $mailbox_size): bool // ===== CODE $return_imap_set_quota = imap_set_quota( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $quota_root, // string quota_root - The mailbox to have a quota set. This should follow the IMAP standard format for a mailbox: user.name. $mailbox_size // int mailbox_size - The maximum size (in KB) for the quota_root ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_set_quota() example // [php] // $mbox = imap_open("{imap.example.org:143}", "mailadmin", "password"); // // if (!imap_set_quota($mbox, "user.kalowsky", 3000)) { // echo "Error in setting quota\n"; // return; // } // // imap_close($mbox); // [/php] // [/example] // [/examples] // // Notes // This function is currently only available to users of the c-client2000 or greater library. // The given imap must be opened as the mail administrator, other wise this function will fail. // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-set-quota.php // ========== IMAP_SET_QUOTA - END // SYNTAX: // bool imap_set_quota(IMAP\Connection $imap, string $quota_root, int $mailbox_size) return $return_imap_set_quota; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_SET_QUOTA // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_SETACL // ============================== PUBLIC // ============================== ABOUT // Sets the ACL for a given mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_setacl() - PHP_4 >= PHP_4_0_7, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_setacl($imap, $mailbox, $user_id, $rights) { $return_imap_setacl = false; // ========== IMAP_SETACL - BEGIN // ===== ABOUT // Sets the ACL for a given mailbox // ===== DESCRIPTION // Sets the ACL for a giving mailbox. // ===== SUPPORTED // PHP_4 >= PHP_4_0_7, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_setacl( // IMAP\Connection $imap, // string $mailbox, // string $user_id, // string $rights // ): bool // ===== CODE $return_imap_setacl = imap_setacl( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $mailbox, // string mailbox - The mailbox name, see imap_open() for more information // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. $user_id, // string user_id - The user to give the rights to. $rights // string rights - The rights to give to the user. Passing an empty string will delete acl. ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // Notes // This function is currently only available to users of the c-client2000 or greater library. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-setacl.php // ========== IMAP_SETACL - END // SYNTAX: // bool imap_setacl(IMAP\Connection $imap, string $mailbox, string $user_id, string $rights) return $return_imap_setacl; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_SETACL // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_SETFLAG_FULL // ============================== PUBLIC // ============================== ABOUT // Sets flags on messages. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_setflag_full() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_setflag_full($imap, $sequence, $flag, $options = 0) { $return_imap_setflag_full = false; // ========== IMAP_SETFLAG_FULL - BEGIN // ===== ABOUT // Sets flags on messages // ===== DESCRIPTION // Causes a store to add the specified flag to the flags set for the messages in the specified sequence. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_setflag_full( // IMAP\Connection $imap, // string $sequence, // string $flag, // int $options = 0 // ): true // ===== CODE $return_imap_setflag_full = imap_setflag_full( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $sequence, // string sequence - A sequence of message numbers. You can enumerate desired messages with the X,Y syntax, or retrieve all messages within an interval with the X:Y syntax $flag, // string flag - The flags which you can set are \Seen, \Answered, \Flagged, \Deleted, and \Draft as defined by > RFC2060. $options // int options - A bit mask that may contain the single option: // * ST_UID - The sequence argument contains UIDs instead of sequence numbers ); // Return Values // Always returns true. // // Errors/Exceptions // Throws a ValueError if options is invalid. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // 8.0.0 - A ValueError is now thrown on invalid options parameter values. Previously, a warning was emitted and the function returned false. // // [examples] // Examples // [example] // Example #1 imap_setflag_full() example // [php] // $mbox = imap_open("{imap.example.org:143}", "username", "password") // or die("can't connect: " . imap_last_error()); // // $status = imap_setflag_full($mbox, "2,5", "\\Seen \\Flagged"); // // echo gettype($status) . "\n"; // echo $status . "\n"; // // imap_close($mbox); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-setflag-full.php // ========== IMAP_SETFLAG_FULL - END // SYNTAX: // bool imap_setflag_full(IMAP\Connection $imap, string $sequence, string $flag, int $options = 0) return $return_imap_setflag_full; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_SETFLAG_FULL // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_SORT // ============================== PUBLIC // ============================== ABOUT // Gets and sort messages. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_sort() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_sort($imap, $criteria, $reverse, $flags = 0, $search_criteria = null, $charset = null) { $return_imap_sort = false; // ========== IMAP_SORT - BEGIN // ===== ABOUT // Gets and sort messages // ===== DESCRIPTION // Gets and sorts message numbers by the given parameters. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_sort( // IMAP\Connection $imap, // int $criteria, // bool $reverse, // int $flags = 0, // ?string $search_criteria = null, // ?string $charset = null // ): array|false // ===== CODE $return_imap_sort = imap_sort( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $criteria, // int criteria - Criteria can be one (and only one) of the following: // * 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 $reverse, // bool reverse - Whether to sort in reverse order. $flags, // int flags - The flags are a bitmask of one or more of the following: // * SE_UID - Return UIDs instead of sequence numbers // * SE_NOPREFETCH - Don't prefetch searched messages $search_criteria, // string search_criteria - IMAP2-format search criteria string. For details see imap_search(). $charset // string charset - MIME character set to use when sorting strings. ); // Return Values // Returns an array of message numbers sorted by the given parameters, or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // 8.0.0 - reverse is now bool instead of int. // 8.0.0 - search_criteria and charset are now nullable. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-sort.php // ========== IMAP_SORT - END // SYNTAX: // array|false imap_sort(IMAP\Connection $imap, int $criteria, bool $reverse, int $flags = 0, string $search_criteria = null, string $charset = null) return $return_imap_sort; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_SORT // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_STATUS // ============================== PUBLIC // ============================== ABOUT // Returns status information on a mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_status() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_status($imap, $mailbox, $flags) { $return_imap_status = false; // ========== IMAP_STATUS - BEGIN // ===== ABOUT // Returns status information on a mailbox // ===== DESCRIPTION // Gets status information about the given mailbox. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_status(IMAP\Connection $imap, string $mailbox, int $flags): stdClass|false // ===== CODE $return_imap_status = imap_status( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $mailbox, // string mailbox - The mailbox name, see imap_open() for more information // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. $flags // int flags - Valid flags are: // * SA_MESSAGES - set $status->messages to the number of messages in the mailbox // * SA_RECENT - set $status->recent to the number of recent messages in the mailbox // * SA_UNSEEN - set $status->unseen to the number of unseen (new) messages in the mailbox // * SA_UIDNEXT - set $status->uidnext to the next uid to be used in the mailbox // * SA_UIDVALIDITY - set $status->uidvalidity to a constant that changes when uids for the mailbox may no longer be valid // * SA_ALL - set all of the above ); // Return Values // This function returns an object containing status information, or false on failure. The object has the following properties: messages, recent, unseen, uidnext, and uidvalidity. // flags is also set, which contains a bitmask which can be checked against any of the above constants. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_status() example // [php] // $mbox = imap_open("{imap.example.com}", "username", "password", OP_HALFOPEN) // or die("can't connect: " . imap_last_error()); // // $status = imap_status($mbox, "{imap.example.org}INBOX", SA_ALL); // if ($status) { // echo "Messages: " . $status->messages . "
\n"; // echo "Recent: " . $status->recent . "
\n"; // echo "Unseen: " . $status->unseen . "
\n"; // echo "UIDnext: " . $status->uidnext . "
\n"; // echo "UIDvalidity:" . $status->uidvalidity . "
\n"; // } else { // echo "imap_status failed: " . imap_last_error() . "\n"; // } // // imap_close($mbox); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-status.php // ========== IMAP_STATUS - END // SYNTAX: // stdClass|false imap_status(IMAP\Connection $imap, string $mailbox, int $flags) return $return_imap_status; // stdClass|false } // ============================== END // PHP_MAIL_IMAP_IMAP_STATUS // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_SUBSCRIBE // ============================== PUBLIC // ============================== ABOUT // Subscribe to a mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_subscribe() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_subscribe($imap, $mailbox) { $return_imap_subscribe = false; // ========== IMAP_SUBSCRIBE - BEGIN // ===== ABOUT // Subscribe to a mailbox // ===== DESCRIPTION // Subscribe to a new mailbox. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_subscribe(IMAP\Connection $imap, string $mailbox): bool // ===== CODE $return_imap_subscribe = imap_subscribe( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $mailbox // string mailbox - The mailbox name, see imap_open() for more information // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-subscribe.php // ========== IMAP_SUBSCRIBE - END // SYNTAX: // bool imap_subscribe(IMAP\Connection $imap, string $mailbox) return $return_imap_subscribe; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_SUBSCRIBE // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_THREAD // ============================== PUBLIC // ============================== ABOUT // Returns a tree of threaded message. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_thread() - PHP_4 >= PHP_4_0_7, PHP_5, PHP_7, PHP_8 // ============================== USING CONSTANTS (1) // SE_FREE - imap_thread() // ============================== CODE function php_mail_imap_imap_thread($imap, $flags = SE_FREE) { $return_imap_thread = false; // ========== IMAP_THREAD - BEGIN // ===== ABOUT // Returns a tree of threaded message // ===== DESCRIPTION // Gets a tree of a threaded message. // ===== SUPPORTED // PHP_4 >= PHP_4_0_7, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_thread(IMAP\Connection $imap, int $flags = SE_FREE): array|false // ===== CODE $return_imap_thread = imap_thread( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $flags // int flags ); // Return Values // imap_thread() returns an associative array containing a tree of messages threaded by REFERENCES, or false on error. // Every message in the current mailbox will be represented by three entries in the resulting array: // * $thread["XX.num"] - current message number // * $thread["XX.next"] - // * $thread["XX.branch"] - // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // [examples] // Examples // [example] // Example #1 imap_thread() Example // [php] // // // Here we're outputting the threads of a newsgroup, in HTML // // $nntp = imap_open('{news.example.com:119/nntp}some.newsgroup', '', ''); // $threads = imap_thread($nntp); // // foreach ($threads as $key => $val) { // $tree = explode('.', $key); // if ($tree[1] == 'num') { // $header = imap_headerinfo($nntp, $val); // echo "
    \n\t
  • " . $header->fromaddress . "\n"; // } elseif ($tree[1] == 'branch') { // echo "\t
  • \n
\n"; // } // } // // imap_close($nntp); // // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-thread.php // ========== IMAP_THREAD - END // SYNTAX: // array|false imap_thread(IMAP\Connection $imap, int $flags = SE_FREE) return $return_imap_thread; // array|false } // ============================== END // PHP_MAIL_IMAP_IMAP_THREAD // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_TIMEOUT // ============================== PUBLIC // ============================== ABOUT // Set or fetch imap timeout. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_timeout() - PHP_4 >= PHP_4_3_3, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_timeout($timeout_type, $timeout = -1) { $return_imap_timeout = false; // ========== IMAP_TIMEOUT - BEGIN // ===== ABOUT // Set or fetch imap timeout // ===== DESCRIPTION // Sets or fetches the imap timeout. // ===== SUPPORTED // PHP_4 >= PHP_4_3_3, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_timeout(int $timeout_type, int $timeout = -1): int|bool // ===== CODE $return_imap_timeout = imap_timeout( $timeout_type, // int timeout_type - One of the following: IMAP_OPENTIMEOUT, IMAP_READTIMEOUT, IMAP_WRITETIMEOUT, or IMAP_CLOSETIMEOUT. $timeout // int timeout - The timeout, in seconds. ); // Return Values // If the timeout parameter is set, this function returns true on success and false on failure. // If timeout is not provided or evaluates to -1, the current timeout value of timeout_type is returned as an integer. // // [examples] // Examples // [example] // Example #1 imap_timeout() example // [php] // // echo "The current read timeout is " . imap_timeout(IMAP_READTIMEOUT) . "\n"; // // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-05) // URL: https://www.php.net/manual/en/function.imap-timeout.php // ========== IMAP_TIMEOUT - END // SYNTAX: // int|bool imap_timeout(int $timeout_type, int $timeout = -1) return $return_imap_timeout; // int|bool } // ============================== END // PHP_MAIL_IMAP_IMAP_TIMEOUT // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_UID // ============================== PUBLIC // ============================== ABOUT // This function returns the UID for the given message sequence number. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_uid() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_uid($imap, $message_num) { $return_imap_uid = false; // ========== IMAP_UID - BEGIN // ===== ABOUT // This function returns the UID for the given message sequence number // ===== DESCRIPTION // This function returns the UID for the given message sequence number. An UID is a 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 imap_msgno(). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_uid(IMAP\Connection $imap, int $message_num): int|false // ===== CODE $return_imap_uid = imap_uid( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $message_num // int message_num - The message number. ); // Return Values // The UID of the given message. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // // Notes // Note: This function is not supported by POP3 mailboxes. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-uid.php // ========== IMAP_UID - END // SYNTAX: // int|false imap_uid(IMAP\Connection $imap, int $message_num) return $return_imap_uid; // int|false } // ============================== END // PHP_MAIL_IMAP_IMAP_UID // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_UNDELETE // ============================== PUBLIC // ============================== ABOUT // Unmark the message which is marked deleted. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_undelete() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_undelete($imap, $message_nums, $flags = 0) { $return_imap_undelete = false; // ========== IMAP_UNDELETE - BEGIN // ===== ABOUT // Unmark the message which is marked deleted // ===== DESCRIPTION // Removes the deletion flag for a specified message, which is set by imap_delete() or imap_mail_move(). // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_undelete(IMAP\Connection $imap, string $message_nums, int $flags = 0): bool // ===== CODE $return_imap_undelete = imap_undelete( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $message_nums, // string message_nums - A string representing one or more messages in IMAP4-style sequence format ("n", "n:m", or combination of these delimited by commas). $flags // int flags ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-06) // URL: https://www.php.net/manual/en/function.imap-undelete.php // ========== IMAP_UNDELETE - END // SYNTAX: // bool imap_undelete(IMAP\Connection $imap, string $message_nums, int $flags = 0) return $return_imap_undelete; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_UNDELETE // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_UNSUBSCRIBE // ============================== PUBLIC // ============================== ABOUT // Unsubscribe from a mailbox. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_unsubscribe() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_unsubscribe($imap, $mailbox) { $return_imap_unsubscribe = false; // ========== IMAP_UNSUBSCRIBE - BEGIN // ===== ABOUT // Unsubscribe from a mailbox // ===== DESCRIPTION // Unsubscribe from the specified mailbox. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_unsubscribe(IMAP\Connection $imap, string $mailbox): bool // ===== CODE $return_imap_unsubscribe = imap_unsubscribe( $imap, // IMAP\Connection imap - An IMAP\Connection instance. $mailbox // string mailbox - The mailbox name, see imap_open() for more information // Warning: Passing untrusted data to this parameter is insecure, unless imap.enable_insecure_rsh is disabled. ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.1.0 - The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-unsubscribe.php // ========== IMAP_UNSUBSCRIBE - END // SYNTAX: // bool imap_unsubscribe(IMAP\Connection $imap, string $mailbox) return $return_imap_unsubscribe; // bool } // ============================== END // PHP_MAIL_IMAP_IMAP_UNSUBSCRIBE // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_UTF7_DECODE // ============================== PUBLIC // ============================== ABOUT // Decodes a modified UTF-7 encoded string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_utf7_decode() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_utf7_decode($string) { $return_imap_utf7_decode = false; // ========== IMAP_UTF7_DECODE - BEGIN // ===== ABOUT // Decodes a modified UTF-7 encoded string // ===== DESCRIPTION // Decodes modified UTF-7 string into ISO-8859-1 string. // This function is needed to decode mailbox names that contain certain characters which are not in range of printable ASCII characters. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_utf7_decode(string $string): string|false // ===== CODE $return_imap_utf7_decode = imap_utf7_decode( $string // string string - A modified UTF-7 encoding string, as defined in > RFC 2060, section 5.1.3. ); // Return Values // Returns a string that is encoded in ISO-8859-1 and consists of the same sequence of characters in string, or false if string contains invalid modified UTF-7 sequence or string contains a character that is not part of ISO-8859-1 character set. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-utf7-decode.php // ========== IMAP_UTF7_DECODE - END // SYNTAX: // string|false imap_utf7_decode(string $string) return $return_imap_utf7_decode; // string|false } // ============================== END // PHP_MAIL_IMAP_IMAP_UTF7_DECODE // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_UTF7_ENCODE // ============================== PUBLIC // ============================== ABOUT // Converts ISO-8859-1 string to modified UTF-7 text. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_utf7_encode() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_utf7_encode($string) { $return_imap_utf7_encode = false; // ========== IMAP_UTF7_ENCODE - BEGIN // ===== ABOUT // Converts ISO-8859-1 string to modified UTF-7 text // ===== DESCRIPTION // Converts string to modified UTF-7 text. // This is needed to encode mailbox names that contain certain characters which are not in range of printable ASCII characters. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_utf7_encode(string $string): string // ===== CODE $return_imap_utf7_encode = imap_utf7_encode( $string // string string - An ISO-8859-1 string. ); // Return Values // Returns string encoded with the modified UTF-7 encoding as defined in > RFC 2060, section 5.1.3. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-utf7-encode.php // ========== IMAP_UTF7_ENCODE - END // SYNTAX: // string imap_utf7_encode(string $string) return $return_imap_utf7_encode; // string } // ============================== END // PHP_MAIL_IMAP_IMAP_UTF7_ENCODE // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_UTF8_TO_MUTF7 // ============================== OFFLINE // ============================== ABOUT // Encode a UTF-8 string to modified UTF-7. // ============================== SUPPORT // PHP_5 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_utf8_to_mutf7() - PHP_5 >= PHP_5_3_0, PHP_7, PHP_8 // ============================== CODE /* function php_mail_imap_imap_utf8_to_mutf7($string) { $return_imap_utf8_to_mutf7 = false; // ========== IMAP_UTF8_TO_MUTF7 - BEGIN // ===== ABOUT // Encode a UTF-8 string to modified UTF-7 // ===== DESCRIPTION // Encode a UTF-8 string to modified UTF-7 (as specified in RFC 2060, section 5.1.3). // Note: This function is only available, if libcclient exports utf8_to_mutf7(). // ===== SUPPORTED // PHP_5 >= PHP_5_3_0, PHP_7, PHP_8 // ===== SYNTAX // imap_utf8_to_mutf7(string $string): string|false // ===== CODE $return_imap_utf8_to_mutf7 = imap_utf8_to_mutf7( $string // string string - A UTF-8 encoded string. ); // Return Values // Returns string converted to modified UTF-7, or false on failure. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-07) // URL: https://www.php.net/manual/en/function.imap-utf8-to-mutf7.php // ========== IMAP_UTF8_TO_MUTF7 - END // SYNTAX: // string|false imap_utf8_to_mutf7(string $string) return $return_imap_utf8_to_mutf7; // string|false } */ // ============================== END // PHP_MAIL_IMAP_IMAP_UTF8_TO_MUTF7 // ============================== // ============================== BEGIN // PHP_MAIL_IMAP_IMAP_UTF8 // ============================== PUBLIC // ============================== ABOUT // Converts MIME-encoded text to UTF-8. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // imap_utf8() - PHP_4, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_mail_imap_imap_utf8($mime_encoded_text) { $return_imap_utf8 = null; // ========== IMAP_UTF8 - BEGIN // ===== ABOUT // Converts MIME-encoded text to UTF-8 // ===== DESCRIPTION // Converts the given mime_encoded_text to UTF-8, if the declared charset is known to libc-client. Otherwise the given text is decoded, but not converted to UTF-8. // ===== SUPPORTED // PHP_4, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // imap_utf8(string $mime_encoded_text): string // ===== CODE $return_imap_utf8 = imap_utf8( $mime_encoded_text // string mime_encoded_text - A MIME encoded string. MIME encoding method and the UTF-8 specification are described in > RFC2047 and > RFC2044 respectively. ); // Return Values // Returns the decoded string, if possible converted to UTF-8. // // [examples] // Examples // [example] // Example #1 Basic imap_utf8() Usage // [php] // echo imap_utf8("Johannes =?ISO-8859-1?Q?Schl=FCter?="); // [/php] // The above example will output something similar to: // [result] // Johannes Schlüter // [/result] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.imap-utf8.php // ========== IMAP_UTF8 - END // SYNTAX: // string imap_utf8(string $mime_encoded_text) return $return_imap_utf8; // string } // ============================== END // PHP_MAIL_IMAP_IMAP_UTF8 // ============================== // ============================== END // PHP_MAIL_IMAP // ============================== ?>