Properties

$imapPath

$imapPath : 

Type

$login

$login : 

Type

$password

$password : 

Type

$serverEncoding

$serverEncoding : 

Type

$attachmentsDir

$attachmentsDir : 

Type

Methods

__construct()

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

Parameters

$imapPath
$login
$password
$attachmentsDir
$serverEncoding

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

checkMailbox()

checkMailbox() : \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

\stdClass

createMailbox()

createMailbox(  $mailBoxPath = '') : boolean

Creates a new mailbox specified by mailbox.

Parameters

$mailBoxPath

Returns

boolean

statusMailbox()

statusMailbox() : \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

\stdClass —

| FALSE if the box doesn't exist

searchMailbox()

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

This function performs 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". 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 RFC2060, section 6.4.4).

Parameters

string $criteria

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 mails matching the rest of the criteria
ANSWERED - match mails with the \\ANSWERED flag set
BCC "string" - match mails with "string" in the Bcc: field
BEFORE "date" - match mails with Date: before "date"
BODY "string" - match mails with "string" in the body of the mail
CC "string" - match mails with "string" in the Cc: field
DELETED - match deleted mails
FLAGGED - match mails with the \\FLAGGED (sometimes referred to as Important or Urgent) flag set
FROM "string" - match mails with "string" in the From: field
KEYWORD "string" - match mails with "string" as a keyword
NEW - match new mails
OLD - match old mails
ON "date" - match mails with Date: matching "date"
RECENT - match mails with the \\RECENT flag set
SEEN - match mails that have been read (the \\SEEN flag is set)
SINCE "date" - match mails with Date: after "date"
SUBJECT "string" - match mails with "string" in the Subject:
TEXT "string" - match mails with text "string"
TO "string" - match mails with "string" in the To:
UNANSWERED - match mails that have not been answered
UNDELETED - match mails that are not deleted
UNFLAGGED - match mails that are not flagged
UNKEYWORD "string" - match mails that do not have the keyword "string"
UNSEEN - match mails which have not been read yet

Returns

array —

Mails ids

deleteMail()

deleteMail(  $mailId) : boolean

Marks mails listed in mailId for deletion.

Parameters

$mailId

Returns

boolean

moveMail()

moveMail(  $mailId,   $mailBox) 

Parameters

$mailId
$mailBox

expungeDeletedMails()

expungeDeletedMails() : boolean

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

Returns

boolean

markMailAsRead()

markMailAsRead(  $mailId) : boolean

Add the flag \Seen to a mail.

Parameters

$mailId

Returns

boolean

markMailAsUnread()

markMailAsUnread(  $mailId) : boolean

Remove the flag \Seen from a mail.

Parameters

$mailId

Returns

boolean

markMailAsImportant()

markMailAsImportant(  $mailId) : boolean

Add the flag \Flagged to a mail.

Parameters

$mailId

Returns

boolean

markMailsAsRead()

markMailsAsRead(array  $mailId) : boolean

Add the flag \Seen to a mails.

Parameters

array $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,   $flag) : boolean

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

Parameters

array $mailsIds
$flag

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

Returns

boolean

clearFlag()

clearFlag(array  $mailsIds,   $flag) : boolean

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

Parameters

array $mailsIds
$flag

Flags 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

getMail()

getMail(  $mailId) : \IncomingMail

Get mail data

Parameters

$mailId

Returns

\IncomingMail

isUrlEncoded()

isUrlEncoded(  $string) 

Parameters

$string

__destruct()

__destruct() 

catchError()

catchError(  $a = null,   $b = null,   $c = null,   $d = null) 

Parameters

$a
$b
$c
$d

initImapStream()

initImapStream() 

disconnect()

disconnect() 

getQuota()

getQuota() : array

Retrieve the quota settings per user

Returns

array —
  • FALSE in the case of call failure

initMailPart()

initMailPart(\IncomingMail  $mail,   $partStructure,   $partNum) 

Parameters

\IncomingMail $mail
$partStructure
$partNum

decodeMimeStr()

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

Parameters

$string
$charset

decodeRFC2231()

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

Parameters

$string
$charset