-type PARTSTRUCTURE_PARAM = object{attribute:string, value?:string}
-type PARTSTRUCTURE = object{ id?:string, encoding:int|mixed, partStructure:object[], parameters:PARTSTRUCTURE_PARAM[], dparameters:object{attribute:string, value:string}[], parts:array<int, object{disposition?:string}>, type:int, subtype:string } -type HOSTNAMEANDADDRESS_ENTRY = object{host?:string, personal?:string, mailbox:string} -type HOSTNAMEANDADDRESS = array{0:HOSTNAMEANDADDRESS_ENTRY, 1?:HOSTNAMEANDADDRESS_ENTRY} -type COMPOSE_ENVELOPE = array{ subject?:string } -type COMPOSE_BODY = list<array{ type?:int, encoding?:int, charset?:string, subtype?:string, description?:string, disposition?:array{filename:string} }>
Открытые члены | |
| __construct (string $imapPath, string $login, string $password, string $attachmentsDir=null, string $serverEncoding= 'UTF-8', bool $trimImapPath=true, bool $attachmentFilenameMode=false) | |
| __destruct () | |
| setPathDelimiter (string $delimiter) | |
| getPathDelimiter () | |
| validatePathDelimiter (string $delimiter) | |
| getServerEncoding () | |
| setServerEncoding (string $serverEncoding) | |
| getAttachmentFilenameMode () | |
| setAttachmentFilenameMode (bool $attachmentFilenameMode) | |
| getImapSearchOption () | |
| setImapSearchOption (int $imapSearchOption) | |
| setAttachmentsIgnore (bool $attachmentsIgnore) | |
| getAttachmentsIgnore () | |
| getLogin () | |
| setConnectionArgs (int $options=0, int $retriesNum=0, array $params=null) | |
| setAttachmentsDir (string $attachmentsDir) | |
| getAttachmentsDir () | |
| setConnectionRetry (int $maxAttempts) | |
| setConnectionRetryDelay (int $milliseconds) | |
| hasImapStream () | |
| encodeStringToUtf7Imap (string $str) | |
| decodeStringFromUtf7ImapToUtf8 (string $str) | |
| setMailboxFolder () | |
| switchMailbox (string $imapPath, bool $absolute=true) | |
| disconnect () | |
| setExpungeOnDisconnect (bool $isEnabled) | |
| checkMailbox () | |
| createMailbox (string $name) | |
| deleteMailbox (string $name, bool $absolute=false) | |
| renameMailbox (string $oldName, string $newName) | |
| statusMailbox () | |
| getListingFolders (string $pattern= '*') | |
| searchMailbox (string $criteria= 'ALL', bool $disableServerEncoding=false) | |
| searchMailboxFrom (string $criteria, string $sender, string...$senders) | |
| searchMailboxFromDisableServerEncoding (string $criteria, string $sender, string...$senders) | |
| searchMailboxMergeResults ($single_criteria,...$criteria) | |
| searchMailboxMergeResultsDisableServerEncoding ($single_criteria,...$criteria) | |
| saveMail (int $mailId, string $filename= 'email.eml') | |
| deleteMail (int $mailId) | |
| moveMail ($mailId, string $mailBox) | |
| copyMail ($mailId, string $mailBox) | |
| expungeDeletedMails () | |
| markMailAsRead (int $mailId) | |
| markMailAsUnread (int $mailId) | |
| markMailAsImportant (int $mailId) | |
| markMailsAsRead (array $mailId) | |
| markMailsAsUnread (array $mailId) | |
| markMailsAsImportant (array $mailId) | |
| flagIsSet (int $mailId, string $flag) | |
| setFlag (array $mailsIds, string $flag) | |
| clearFlag (array $mailsIds, string $flag) | |
| getMailboxHeaders () | |
| getMailboxInfo () | |
| sortMails (int $criteria=SORTARRIVAL, bool $reverse=true,?string $searchCriteria= 'ALL', string $charset=null) | |
| countMails () | |
| getRawMail (int $msgId, bool $markAsSeen=true) | |
| getMailHeaderFieldValue (string $headersRaw, string $header_field_name) | |
| convertToUtf8 (string $string, string $fromCharset) | |
| isUrlEncoded (string $string) | |
| parseDateTime (string $dateHeader) | |
| getImapPath () | |
| getMailMboxFormat (int $mailId) | |
| getMailboxes (string $search= '*') | |
| getSubscribedMailboxes (string $search= '*') | |
| subscribeMailbox (string $mailbox) | |
| unsubscribeMailbox (string $mailbox) | |
| appendMessageToMailbox ($message, string $mailbox= '', string $options=null, string $internal_date=null) | |
Поля данных | |
| const | EXPECTED_SIZE_OF_MESSAGE_AS_ARRAY = 2 |
| const | MAX_LENGTH_FILEPATH = 255 |
| const | PART_TYPE_TWO = 2 |
| const | IMAP_OPTIONS_SUPPORTED_VALUES |
| $decodeMimeStrDefaultCharset = 'default' | |
Защищенные члены | |
| lowercase_mb_list_encodings () | |
| initImapStreamWithRetry () | |
| getQuota (string $quota_root= 'INBOX') | |
| initImapStream () | |
| decodeRFC2231 (string $string) | |
| getCombinedPath (string $folder, bool $absolute=false) | |
| pingOrDisconnect () | |
| searchMailboxFromWithOrWithoutDisablingServerEncoding (string $criteria, bool $disableServerEncoding, string $sender, string...$senders) | |
| searchMailboxMergeResultsWithOrWithoutDisablingServerEncoding ($disableServerEncoding, $single_criteria,...$criteria) | |
Защищенные данные | |
| $imapPath | |
| $imapLogin | |
| $imapPassword | |
| $imapSearchOption = SE_UID | |
| $connectionRetry = 0 | |
| $connectionRetryDelay = 100 | |
| $imapOptions = 0 | |
| $imapRetriesNum = 0 | |
| $imapParams = [] | |
| $serverEncoding = 'UTF-8' | |
| $attachmentsDir = null | |
| $expungeOnDisconnect = true | |
| $timeouts = [] | |
| $attachmentsIgnore = false | |
| $pathDelimiter = '.' | |
| $mailboxFolder | |
| $attachmentFilenameMode = false | |
| __construct | ( | string | $imapPath, |
| string | $login, | ||
| string | $password, | ||
| string | $attachmentsDir = null, |
||
| string | $serverEncoding = 'UTF-8', |
||
| bool | $trimImapPath = true, |
||
| bool | $attachmentFilenameMode = false |
||
| ) |
| InvalidParameterException |
| __destruct | ( | ) |
Disconnects from the IMAP server / mailbox.
| appendMessageToMailbox | ( | $message, | |
| string | $mailbox = '', |
||
| string | $options = null, |
||
| string | $internal_date = null |
||
| ) |
Appends $message to $mailbox.
| string | array | $message | -param string|array{0:COMPOSE_ENVELOPE, 1:COMPOSE_BODY} $message |
| checkMailbox | ( | ) |
Get information about the current mailbox.
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 mails in the mailbox Recent - number of recent mails in the mailbox
| clearFlag | ( | array | $mailsIds, |
| string | $flag | ||
| ) |
Causes a store to delete the specified flag to the flags set for the mails in the specified sequence.
| array | $mailsIds | Array of mail IDs |
| string | $flag | Which you can delete are , , , , and as defined by RFC2060 |
| convertToUtf8 | ( | string | $string, |
| string | $fromCharset | ||
| ) |
Converts a string to UTF-8.
| string | $string | MIME string to decode |
| string | $fromCharset | Charset to convert from |
| copyMail | ( | $mailId, | |
| string | $mailBox | ||
| ) |
Copies mails listed in mailId into new mailbox.
| string | int | $mailId | a range or message number |
| string | $mailBox | Mailbox name |
| countMails | ( | ) |
Get mails count in mail box.
| createMailbox | ( | string | $name | ) |
Creates a new mailbox.
| string | $name | Name of new mailbox (eg. 'PhpImap') |
|
protected |
| decodeStringFromUtf7ImapToUtf8 | ( | string | $str | ) |
Returns the provided string in UTF-8 encoded format.
-pure
| deleteMail | ( | int | $mailId | ) |
Marks mails listed in mailId for deletion.
| int | $mailId | message number |
| deleteMailbox | ( | string | $name, |
| bool | $absolute = false |
||
| ) |
Deletes a specific mailbox.
| string | $name | Name of mailbox, which you want to delete (eg. 'PhpImap') |
| disconnect | ( | ) |
Disconnects from IMAP server / mailbox.
| encodeStringToUtf7Imap | ( | string | $str | ) |
Returns the provided string in UTF7-IMAP encoded format.
-pure
| expungeDeletedMails | ( | ) |
Deletes all the mails marked for deletion by imap_delete(), imap_mail_move(), or imap_setflag_full().
| flagIsSet | ( | int | $mailId, |
| string | $flag | ||
| ) |
Check, if the specified flag for the mail is set or not.
| int | $mailId | A single mail ID |
| string | $flag | Which you can get are , , , , and as defined by RFC2060 |
-param int $mailId
| getAttachmentFilenameMode | ( | ) |
Returns the current set attachment filename mode.
| getAttachmentsDir | ( | ) |
Get current saving folder for attachments.
| getAttachmentsIgnore | ( | ) |
Get $this->attachmentsIgnore param.
|
protected |
Combine Subfolder or Folder to the connection. Have the imapPath a folder added to the connection info, then will the $folder added as subfolder. If the parameter $absolute TRUE, then will the connection new builded only with this folder as root element.
| string | $folder | Folder, the will added to the path |
| bool | $absolute | Add folder as root element to the connection and remove all other from this |
| getImapPath | ( | ) |
Gets IMAP path.
| getImapSearchOption | ( | ) |
Returns the current set IMAP search option.
| getListingFolders | ( | string | $pattern = '*' | ) |
Gets listing the folders.
This function returns an object containing listing the folders. The object has the following properties: messages, recent, unseen, uidnext, and uidvalidity.
-return list<string>
| getLogin | ( | ) |
Returns the IMAP login (usually an email address).
| getMailboxes | ( | string | $search = '*' | ) |
Get folders list.
-return list<array{fullpath: string, attributes: mixed, delimiter: mixed, shortpath: false|string}>
-var array<int, scalar|array|object{name?:string}|resource|null>
| getMailboxHeaders | ( | ) |
Get headers for all messages in the defined mailbox, returns an array of string formatted with header info, one element per mail message.
| getMailboxInfo | ( | ) |
Get information about the current mailbox.
Returns an object with following properties: Date - 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
| getMailHeaderFieldValue | ( | string | $headersRaw, |
| string | $header_field_name | ||
| ) |
Get mail header field value.
| string | $headersRaw | RAW headers as single string |
| string | $header_field_name | Name of the required header field |
| getMailMboxFormat | ( | int | $mailId | ) |
Get message in MBOX format.
| int | $mailId | message number |
| getPathDelimiter | ( | ) |
Returns the current set path delimiter character.
|
protected |
Retrieve the quota settings per user.
| string | $quota_root | Should normally be in the form of which mailbox (i.e. INBOX) |
| getRawMail | ( | int | $msgId, |
| bool | $markAsSeen = true |
||
| ) |
Get raw mail data.
| int | $msgId | ID of the message |
| bool | $markAsSeen | Mark the email as seen, when set to true |
| getServerEncoding | ( | ) |
Returns the current set server encoding.
| getSubscribedMailboxes | ( | string | $search = '*' | ) |
Get folders list.
-return list<array{fullpath: string, attributes: mixed, delimiter: mixed, shortpath: false|string}>
-var array<int, scalar|array|object{name?:string}|resource|null>
| hasImapStream | ( | ) |
|
protected |
Open an IMAP stream to a mailbox.
| Exception | if an error occured |
|
protected |
| isUrlEncoded | ( | string | $string | ) |
-pure
|
protected |
Returns the list of available encodings in lower case.
-return list<string>
| markMailAsImportant | ( | int | $mailId | ) |
Add the flag to a mail.
| markMailAsRead | ( | int | $mailId | ) |
Add the flag to a mail.
| markMailAsUnread | ( | int | $mailId | ) |
Remove the flag from a mail.
| markMailsAsImportant | ( | array | $mailId | ) |
Add the flag to some mails.
| int[] | $mailId |
-param list<int> $mailId
| markMailsAsRead | ( | array | $mailId | ) |
Add the flag to a mails.
| int[] | $mailId |
-param list<int> $mailId
| markMailsAsUnread | ( | array | $mailId | ) |
Remove the flag from some mails.
| int[] | $mailId |
-param list<int> $mailId
| moveMail | ( | $mailId, | |
| string | $mailBox | ||
| ) |
Moves mails listed in mailId into new mailbox.
| string | int | $mailId | a range or message number |
| string | $mailBox | Mailbox name |
| parseDateTime | ( | string | $dateHeader | ) |
Converts the datetime to a RFC 3339 compliant format.
| string | $dateHeader | Header datetime |
-pure
|
protected |
| renameMailbox | ( | string | $oldName, |
| string | $newName | ||
| ) |
Rename an existing mailbox from $oldName to $newName.
| string | $oldName | Current name of mailbox, which you want to rename (eg. 'PhpImap') |
| string | $newName | New name of mailbox, to which you want to rename it (eg. 'PhpImapTests') |
| saveMail | ( | int | $mailId, |
| string | $filename = 'email.eml' |
||
| ) |
Save a specific body section to a file.
| int | $mailId | message number |
| searchMailbox | ( | string | $criteria = 'ALL', |
| bool | $disableServerEncoding = false |
||
| ) |
This function uses imap_search() to perform a search on the mailbox currently opened in the given IMAP stream. For example, to match all unanswered mails sent by Mom, you'd use: "UNANSWERED FROM mom".
| string | $criteria | See http://php.net/imap_search for a complete list of available criteria |
| bool | $disableServerEncoding | Disables server encoding while searching for mails (can be useful on Exchange servers) |
-return list<int>
-var list<int>
-var list<int>
| searchMailboxFrom | ( | string | $criteria, |
| string | $sender, | ||
| string... | $senders | ||
| ) |
| searchMailboxFromDisableServerEncoding | ( | string | $criteria, |
| string | $sender, | ||
| string... | $senders | ||
| ) |
Search the mailbox for emails from multiple, specific senders whilst not using server encoding.
-return list<int>
|
protected |
Search the mailbox for emails from multiple, specific senders.
This function wraps Mailbox::searchMailbox() to overcome a shortcoming in ext-imap
-return list<int>
| string | $sender |
| searchMailboxMergeResults | ( | $single_criteria, | |
| $criteria | |||
| ) |
Search the mailbox using multiple criteria merging the results.
| string | $single_criteria | |
| string | ...$criteria |
-return list<int>
| searchMailboxMergeResultsDisableServerEncoding | ( | $single_criteria, | |
| $criteria | |||
| ) |
Search the mailbox using multiple criteria merging the results.
| string | $single_criteria | |
| string | ...$criteria |
-return list<int>
|
protected |
Search the mailbox using different criteria, then merge the results.
| bool | $disableServerEncoding | |
| string | $single_criteria | |
| string | ...$criteria |
-return list<int>
-var list<int>
| setAttachmentFilenameMode | ( | bool | $attachmentFilenameMode | ) |
Sets / Changes the attachment filename mode.
| bool | $attachmentFilenameMode | Attachment filename mode (e.g. false) |
| InvalidParameterException |
| setAttachmentsDir | ( | string | $attachmentsDir | ) |
Set custom folder for attachments in case you want to have tree of folders for each email i.e. a/1 b/1 c/1 where a,b,c - senders, i.e. john@smith.com.
| string | $attachmentsDir | Folder where to save attachments |
| InvalidParameterException |
| setAttachmentsIgnore | ( | bool | $attachmentsIgnore | ) |
Set $this->attachmentsIgnore param. Allow to ignore attachments when they are not required and boost performance.
| setConnectionArgs | ( | int | $options = 0, |
| int | $retriesNum = 0, |
||
| array | $params = null |
||
| ) |
Set custom connection arguments of imap_open method. See http://php.net/imap_open.
| string[]|null | $params |
-param array{DISABLE_AUTHENTICATOR?:string}|array<empty, empty>|null $params
| InvalidParameterException |
| setConnectionRetry | ( | int | $maxAttempts | ) |
Sets / Changes the attempts / retries to connect.
| setConnectionRetryDelay | ( | int | $milliseconds | ) |
Sets / Changes the delay between each attempt / retry to connect.
| setExpungeOnDisconnect | ( | bool | $isEnabled | ) |
Sets 'expunge on disconnect' parameter.
| setFlag | ( | array | $mailsIds, |
| string | $flag | ||
| ) |
Causes a store to add the specified flag to the flags set for the mails in the specified sequence.
| array | $mailsIds | Array of mail IDs |
| string | $flag | Which you can set are , , , , and as defined by RFC2060 |
-param list<int> $mailsIds
| setImapSearchOption | ( | int | $imapSearchOption | ) |
Sets / Changes the IMAP search option.
| int | $imapSearchOption | IMAP search option (eg. 'SE_UID') |
-param 1|2 $imapSearchOption
| InvalidParameterException |
| setMailboxFolder | ( | ) |
Sets the folder of the current mailbox.
| setPathDelimiter | ( | string | $delimiter | ) |
Sets / Changes the path delimiter character (Supported values: '.', '/').
| string | $delimiter | Path delimiter |
| InvalidParameterException |
| setServerEncoding | ( | string | $serverEncoding | ) |
Sets / Changes the server encoding.
| string | $serverEncoding | Server encoding (eg. 'UTF-8') |
| InvalidParameterException |
| sortMails | ( | int | $criteria = SORTARRIVAL, |
| bool | $reverse = true, |
||
| ?string | $searchCriteria = 'ALL', |
||
| string | $charset = null |
||
| ) |
Gets mails ids sorted by some criteria.
Criteria can be one (and only one) of the following constants: SORTDATE - mail Date SORTARRIVAL - arrival date (default) SORTFROM - mailbox in first From address SORTSUBJECT - mail subject SORTTO - mailbox in first To address SORTCC - mailbox in first cc address SORTSIZE - size of mail in octets
| int | $criteria | Sorting criteria (eg. SORTARRIVAL) |
| bool | $reverse | Sort reverse or not |
| string | null | $searchCriteria | See http://php.net/imap_search for a complete list of available criteria |
-param value-of<Imap::SORT_CRITERIA> $criteria
-return list<int>
| statusMailbox | ( | ) |
Gets status information about the given mailbox.
This function returns an object containing status information. The object has the following properties: messages, recent, unseen, uidnext, and uidvalidity.
| subscribeMailbox | ( | string | $mailbox | ) |
Subscribe to a mailbox.
| Exception |
| switchMailbox | ( | string | $imapPath, |
| bool | $absolute = true |
||
| ) |
Switch mailbox without opening a new connection.
| Exception |
| unsubscribeMailbox | ( | string | $mailbox | ) |
Unsubscribe from a mailbox.
| Exception |
| validatePathDelimiter | ( | string | $delimiter | ) |
Validates the given path delimiter character.
| string | $delimiter | Path delimiter |
-pure
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| $decodeMimeStrDefaultCharset = 'default' |
|
protected |
|
protected |
|
protected |
|
protected |
-var array{DISABLE_AUTHENTICATOR?:string}
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| const EXPECTED_SIZE_OF_MESSAGE_AS_ARRAY = 2 |
| const IMAP_OPTIONS_SUPPORTED_VALUES |
| const MAX_LENGTH_FILEPATH = 255 |
| const PART_TYPE_TWO = 2 |