Properties

$imapPath

$imapPath : string

Путь к IMAP

Type

string

$imapLogin

$imapLogin : string

Логин в IMAP

Type

string

$imapPassword

$imapPassword : string

Пароль в IMAP

Type

string

$imapOptions

$imapOptions : integer

Опции IMAP

Type

integer

$imapRetriesNum

$imapRetriesNum : integer

Количество попыток подключения

Type

integer

$imapParams

$imapParams : array

Параметры IMAP

Type

array

$serverEncoding

$serverEncoding : string

Кодировка сервера

Type

string

$attachmentsDir

$attachmentsDir : string

Папка для хранения вложений

Type

string

$expungeOnDisconnect

$expungeOnDisconnect : boolean

Черти что :)

Type

boolean

$imapStream

$imapStream : resource

Стрим IMAP

Type

resource

Methods

__construct()

__construct(string  $imapPath, string  $login, string  $password, string  $attachmentsDir = null, string  $serverEncoding = 'UTF-8') 

Конструктор

Parameters

string $imapPath

путь к IMAP

string $login

логин

string $password

пароль

string $attachmentsDir

директория для хранения вложений

string $serverEncoding

кодировка сервера

Throws

\Colibri\IO\Mail\Mailbox\Exception

setConnectionArgs()

setConnectionArgs(integer  $options, integer  $retriesNum, array  $params = null) 

Set custom connection arguments of imap_open method. See http://php.net/imap_open

Parameters

integer $options
integer $retriesNum
array $params

setAttachmentsDir()

setAttachmentsDir(string  $dir) : void

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

Parameters

string $dir

folder where to save attachments

getImapStream()

getImapStream(boolean  $forceConnection = true) : null|resource

Get IMAP mailbox connection stream

Parameters

boolean $forceConnection

Initialize connection if it's not initialized

Returns

null|resource

switchMailbox()

switchMailbox(string  $imapPath = '') 

Switch mailbox without opening a new connection

Parameters

string $imapPath

setExpungeOnDisconnect()

setExpungeOnDisconnect(boolean  $isEnabled) 

Sets 'expunge on disconnect' parameter

Parameters

boolean $isEnabled

checkMailbox()

checkMailbox() : \Colibri\IO\Mail\Mailbox\stdClass

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

Returns

\Colibri\IO\Mail\Mailbox\stdClass

createMailbox()

createMailbox() : boolean

Creates a new mailbox specified by mailbox.

Returns

boolean

statusMailbox()

statusMailbox() : \Colibri\IO\Mail\Mailbox\stdClass

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.

Returns

\Colibri\IO\Mail\Mailbox\stdClass —

if the box doesn't exist

getListingFolders()

getListingFolders() : array

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.

Returns

array —

listing the folders

searchMailbox()

searchMailbox(string  $criteria = 'ALL') : array

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".

Parameters

string $criteria

See http://php.net/imap_search for a complete list of available criteria

Returns

array —

mailsIds (or empty array)

saveMail()

saveMail(string  $mailId, string  $filename = 'email.eml') : boolean

Save mail body.

Parameters

string $mailId
string $filename

Returns

boolean

deleteMail()

deleteMail(string  $mailId) : boolean

Marks mails listed in mailId for deletion.

Parameters

string $mailId

Returns

boolean

moveMail()

moveMail(string  $mailId, string  $mailBox) : boolean

Moves mails listed in mailId into new mailbox

Parameters

string $mailId
string $mailBox

Returns

boolean

copyMail()

copyMail(string  $mailId, string  $mailBox) : boolean

Copys mails listed in mailId into new mailbox

Parameters

string $mailId
string $mailBox

Returns

boolean

expungeDeletedMails()

expungeDeletedMails() : boolean

Deletes all the mails marked for deletion by imap_delete(), imap_mail_move(), or imap_setflag_full().

Returns

boolean

markMailAsRead()

markMailAsRead(string  $mailId) : boolean

Add the flag \Seen to a mail.

Parameters

string $mailId

Returns

boolean

markMailAsUnread()

markMailAsUnread(string  $mailId) : boolean

Remove the flag \Seen from a mail.

Parameters

string $mailId

Returns

boolean

markMailAsImportant()

markMailAsImportant(string  $mailId) : boolean

Add the flag \Flagged to a mail.

Parameters

string $mailId

Returns

boolean

markMailsAsRead()

markMailsAsRead(string  $mailId) : boolean

Add the flag \Seen to a mails.

Parameters

string $mailId

Returns

boolean

markMailsAsUnread()

markMailsAsUnread(array  $mailId) : boolean

Remove the flag \Seen from some mails.

Parameters

array $mailId

Returns

boolean

markMailsAsImportant()

markMailsAsImportant(array  $mailId) : boolean

Add the flag \Flagged to some mails.

Parameters

array $mailId

Returns

boolean

setFlag()

setFlag(array  $mailsIds, string  $flag) : boolean

Causes a store to add the specified flag to the flags set for the mails in the specified sequence.

Parameters

array $mailsIds
string $flag

which you can set are \Seen, \Answered, \Flagged, \Deleted, and \Draft as defined by RFC2060.

Returns

boolean

clearFlag()

clearFlag(array  $mailsIds, string  $flag) : boolean

Cause a store to delete the specified flag to the flags set for the mails in the specified sequence.

Parameters

array $mailsIds
string $flag

which you can set are \Seen, \Answered, \Flagged, \Deleted, and \Draft as defined by RFC2060.

Returns

boolean

getMailsInfo()

getMailsInfo(array  $mailsIds) : array

Fetch mail headers for listed mails ids

Returns an array of objects describing one mail header each. The object will only define a property if it exists. The possible properties are: subject - the mails subject from - who sent it to - recipient date - when was it sent message_id - Mail-ID references - is a reference to this mail id in_reply_to - is a reply to this mail id size - size in bytes uid - UID the mail has in the mailbox msgno - mail sequence number in the mailbox recent - this mail is flagged as recent flagged - this mail is flagged answered - this mail is flagged as answered deleted - this mail is flagged for deletion seen - this mail is flagged as already read draft - this mail is flagged as being a draft

Parameters

array $mailsIds

Returns

array

getMailboxInfo()

getMailboxInfo() : object

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

Returns

object —

Object with info | FALSE on failure

sortMails()

sortMails(integer  $criteria = SORTARRIVAL, boolean  $reverse = true) : array

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

Parameters

integer $criteria
boolean $reverse

Returns

array —

Mails ids

countMails()

countMails() : integer

Get mails count in mail box

Returns

integer

getQuotaLimit()

getQuotaLimit() : integer

Return quota limit in KB

Returns

integer —
  • FALSE in the case of call failure

getQuotaUsage()

getQuotaUsage() : integer

Return quota usage in KB

Returns

integer —
  • FALSE in the case of call failure

getRawMail()

getRawMail(  $msgId, boolean  $markAsSeen = true) : mixed

Get raw mail data

Parameters

$msgId
boolean $markAsSeen

Returns

mixed

getMail()

getMail(  $mailId, boolean  $markAsSeen = true) : \Colibri\IO\Mail\Mailbox\Mail

Get mail data

Parameters

$mailId
boolean $markAsSeen

Returns

\Colibri\IO\Mail\Mailbox\Mail

isUrlEncoded()

isUrlEncoded(string  $string) : boolean

Проверяет не закодирована ли строка как urlencode

Parameters

string $string

Returns

boolean

__destruct()

__destruct() 

Деструктор

initImapStream()

initImapStream() : void

Создает стрим IMAP

disconnect()

disconnect() : void

Отключиться

getQuota()

getQuota() : array

Retrieve the quota settings per user

Returns

array —
  • FALSE in the case of call failure

initMailPart()

initMailPart(\Colibri\IO\Mail\Mailbox\Mail  $mail, mixed  $partStructure, mixed  $partNum, boolean  $markAsSeen = true) : void

Создает пакет IMAP

Parameters

\Colibri\IO\Mail\Mailbox\Mail $mail
mixed $partStructure
mixed $partNum
boolean $markAsSeen

decodeMimeStr()

decodeMimeStr(string  $string, string  $charset = 'utf-8') : string

Декодирует строку MIME

Parameters

string $string
string $charset

Returns

string

decodeRFC2231()

decodeRFC2231(string  $string, string  $charset = 'utf-8') : string

Декодирует RFC2231

Parameters

string $string
string $charset

Returns

string

convertStringEncoding()

convertStringEncoding(string  $string, string  $fromEncoding, string  $toEncoding) : string

Converts a string from one encoding to another.

Parameters

string $string
string $fromEncoding
string $toEncoding

Returns

string —

Converted string if conversion was successful, or the original string if not

setImapPath()

setImapPath(string  $imapPath) : void

Устанавливает путь к IMAP

Parameters

string $imapPath