AfterLogic API Documentation
  • Package
  • Class

Packages

  • Calendar
    • Classes
    • Storages
  • Capability
  • Channels
    • Classes
    • Storages
  • Collaboration
  • Contacts
    • Helpers
    • Storages
  • Dav
  • Db
    • Classes
    • Enum
    • Storages
  • Domains
    • Classes
    • Storages
  • Fetchers
    • Classes
    • Storages
  • Filecache
    • Storages
  • Filestorage
    • Classes
    • Storages
  • GContacts
    • Storages
  • Helpdesk
    • Classes
    • Enum
    • Storages
  • Integrator
  • IOS
  • Logger
  • Mail
    • Classes
    • Enum
    • Storages
  • Mailsuite
    • Classes
    • Storages
  • Min
    • Storages
  • Sieve
    • Classes
    • Enum
  • Social
    • Classes
    • Storages
  • Subscription
    • Classes
  • Subscriptions
    • Storages
  • Tenants
    • Classes
    • Storages
  • Twofactorauth
    • Classes
    • Storages
  • Users
    • Classes
    • Enum
    • Storages
  • Voice
  • WebMail
    • Storages

Classes

  • CApiMailManager

Class CApiMailManager

Manager for work with ImapClient.

AApiManagerWithStorage
Extended by CApiMailManager
Package: Mail
Located at mail/manager.php

Methods summary

public
# __construct( CApiGlobalManager & $oManager )

Initializes manager property.

Initializes manager property.

Parameters

$oManager
$oManager Manager object.
protected MailSo\Imap\ImapClient|null &
# _getImapClient( CAccount $oAccount, integer $iForceConnectTimeOut = 0, integer $iForceSocketTimeOut = 0 )

Returns ImapClient object from cache.

Returns ImapClient object from cache.

Parameters

$oAccount
Account object.
$iForceConnectTimeOut
= 0. The value overrides connection timeout value.
$iForceSocketTimeOut
= 0. The value overrides socket timeout value.

Returns

MailSo\Imap\ImapClient|null
public MailSo\Imap\ImapClient|null &
# getImapClient( CAccount $oAccount, type $iForceConnectTimeOut = 0, type $iForceSocketTimeOut = 0 )

Creates a new instance of ImapClient class.

Creates a new instance of ImapClient class.

Parameters

$oAccount
Account object.
$iForceConnectTimeOut
= 0. The value overrides connection timeout value.
$iForceSocketTimeOut
= 0. The value overrides socket timeout value.

Returns

MailSo\Imap\ImapClient|null
public
# validateAccountConnection( CAccount $oAccount )

Checks if user of the account can successfully connect to mail server.

Checks if user of the account can successfully connect to mail server.

Parameters

$oAccount
Account object.

Throws

CApiManagerException
public boolean
# setSystemFolderNames( CAccount $oAccount, array $aSystemNames )

Updates information on system folders use.

Updates information on system folders use.

Parameters

$oAccount
Account object.
$aSystemNames
Array containing mapping of folder types and their actual IMAP names.

Returns

boolean
public array|boolean
# getSystemFolderNames( CAccount $oAccount )

Gets information about system folders of the account.

Gets information about system folders of the account.

Parameters

$oAccount
Account object.

Returns

array|boolean
public CApiMailFolderCollection
# getFolders( CAccount $oAccount, boolean $bCreateUnExistenSystemFolders = true )

Obtains the list of IMAP folders.

Obtains the list of IMAP folders.

Parameters

$oAccount
Account object.
$bCreateUnExistenSystemFolders
= true. Creating folders is required for WebMail work, usually it is done on first login to the account.

Returns

CApiMailFolderCollection
Collection of folders.
public array
# getFoldersOrder( CAccount $oAccount )

Obtains folders order.

Obtains folders order.

Parameters

$oAccount
Account object.

Returns

array
public boolean
# updateFoldersOrder( CAccount $oAccount, array $aOrder )

Updates folders order.

Updates folders order.

Parameters

$oAccount
Account object.
$aOrder
New folders order.

Returns

boolean
public
# createFolderByFullName( CAccount $oAccount, string $sFolderFullNameRaw, boolean $bSubscribeOnCreation = true )

Creates a new folder using its full name in IMAP folders tree.

Creates a new folder using its full name in IMAP folders tree.

Parameters

$oAccount
Account object.
$sFolderFullNameRaw
Raw full name of the folder.
$bSubscribeOnCreation
= true. If true the folder will be subscribed and thus made visible in the interface.

Throws

CApiInvalidArgumentException
public boolean
# isExtensionSupported( CAccount $oAccount, string $sExtensionName )

Checks if particular extension is supported.

Checks if particular extension is supported.

Parameters

$oAccount
Account object.
$sExtensionName
Extension name.

Returns

boolean
public array
# getFolderInformation( CAccount $oAccount, string $sFolderFullNameRaw )

Obtains information about particular folder.

Obtains information about particular folder.

Parameters

$oAccount
Account object.
$sFolderFullNameRaw
Raw full name of the folder.

Returns

array

array containing the following elements: - total number of messages; - number of unread messages; - UIDNEXT value for the folder; - hash string which changes its value if any of the other 3 values were changed.

public array
# getNewMessagesInformation( CAccount $oAccount, string $sFolderFullNameRaw, string $sUidnext, $sNewInboxUidnext )

Retrieves information about new message, primarily used for Inbox folder.

Retrieves information about new message, primarily used for Inbox folder.

Parameters

$oAccount
Account object.
$sFolderFullNameRaw
Raw full name of the folder.
$sUidnext
UIDNEXT value used for this operation.
$sNewInboxUidnext

Returns

array
public array
# getFolderListInformation( CAccount $oAccount, array $aFolderFullNamesRaw, string $sInboxUidnext = '', array $oNewInboxData = null )

Obtains information about particular folders.

Obtains information about particular folders.

Parameters

$oAccount
Account object.
$aFolderFullNamesRaw
Array containing a list of folder names to obtain information for.
$sInboxUidnext
= ''. UIDNEXT value for Inbox folder.
$oNewInboxData
= null. Extended statistics, works for Inbox only.

Returns

array
Array containing elements like those returned by getFolderInformation method.
public
# createFolder( CAccount $oAccount, string $sFolderNameInUtf8, string $sDelimiter, string $sFolderParentFullNameRaw = '', boolean $bSubscribeOnCreation = true )

Creates a new folder.

Creates a new folder.

Parameters

$oAccount
Account object.
$sFolderNameInUtf8
Folder name in utf8.
$sDelimiter
IMAP delimiter value.
$sFolderParentFullNameRaw
= ''. Parent folder this new one is created under.
$bSubscribeOnCreation
= true. If true, the folder will be subscribed and thus made visible in the interface.

Throws

CApiInvalidArgumentException
CApiBaseException
public
# deleteFolder( CAccount $oAccount, string $sFolderFullNameRaw, boolean $bUnsubscribeOnDeletion = true )

Deletes folder.

Deletes folder.

Parameters

$oAccount
Account object.
$sFolderFullNameRaw
Raw full name of the folder.
$bUnsubscribeOnDeletion
= true. If true the folder will be unsubscribed along with its deletion.

Throws

CApiInvalidArgumentException
public string
# renameFolder( CAccount $oAccount, string $sPrevFolderFullNameRaw, string $sNewTopFolderNameInUtf8 )

Changes folder's name.

Changes folder's name.

Parameters

$oAccount
Account object.
$sPrevFolderFullNameRaw
Raw full name of the folder.
$sNewTopFolderNameInUtf8
= ''. New name for the folder in utf8.

Returns

string

Throws

CApiInvalidArgumentException
CApiBaseException
public
# subscribeFolder( CAccount $oAccount, string $sFolderFullNameRaw, boolean $bSubscribeAction = true )

Subscribes to IMAP folder or unsubscribes from it.

Subscribes to IMAP folder or unsubscribes from it.

Parameters

$oAccount
Account object.
$sFolderFullNameRaw
Raw full name of the folder.
$bSubscribeAction
= true. If true the folder will be subscribed, otherwise unsubscribed.

Throws

CApiInvalidArgumentException
public
# clearFolder( CAccount $oAccount, string $sFolderFullNameRaw )

Purges all the content of a particular folder.

Purges all the content of a particular folder.

Parameters

$oAccount
Account object.
$sFolderFullNameRaw
Raw full name of the folder.

Throws

CApiInvalidArgumentException
public
# deleteMessage( CAccount $oAccount, string $sFolderFullNameRaw, array $aUids )

Deletes one or several messages from IMAP.

Deletes one or several messages from IMAP.

Parameters

$oAccount
Account object.
$sFolderFullNameRaw
Folder the messages are to be deleted from.
$aUids
List of message UIDs.

Throws

CApiInvalidArgumentException
public
# moveMessage( CAccount $oAccount, string $sFromFolderFullNameRaw, string $sToFolderFullNameRaw, array $aUids )

Moves message from one folder to another.

Moves message from one folder to another.

Parameters

$oAccount
Account object.
$sFromFolderFullNameRaw
Raw full name of the source folder.
$sToFolderFullNameRaw
Raw full name of the destination folder.
$aUids
List of message UIDs.

Throws

CApiInvalidArgumentException
public
# copyMessage( CAccount $oAccount, string $sFromFolderFullNameRaw, string $sToFolderFullNameRaw, array $aUids )

Copies one or several message from one folder to another.

Copies one or several message from one folder to another.

Parameters

$oAccount
Account object.
$sFromFolderFullNameRaw
Raw full name of source folder.
$sToFolderFullNameRaw
Raw full name of destination folder.
$aUids
List of message UIDs.

Throws

CApiInvalidArgumentException
public array|boolean
# sendMessage( CAccount $oAccount, MailSo\Mime\Message $oMessage, CFetcher $oFetcher = null, string $sSentFolder = '', string $sDraftFolder = '', string $sDraftUid = '' )

Sends message out.

Sends message out.

Parameters

$oAccount
Account object.
$oMessage
Message to be sent out.
$oFetcher
= null. Fetcher object which may override sending settings.
$sSentFolder
= ''. Name of Sent folder.
$sDraftFolder
= ''. Name of Sent folder.
$sDraftUid
= ''. Last UID value of the message saved in Drafts folder.

Returns

array|boolean

Throws

CApiInvalidArgumentException
public array|boolean
# saveMessage( CAccount $oAccount, MailSo\Mime\Message $oMessage, string $sDraftFolder, string $sDraftUid = '' )

Saves message to a specific folder. The method is primarily used for saving drafts.

Saves message to a specific folder. The method is primarily used for saving drafts.

Parameters

$oAccount
Account object.
$oMessage
Object representing message to be saved.
$sDraftFolder
Folder the message is saved to.
$sDraftUid
= ''. UID of the message to be replaced; saving new draft removes the previous version.

Returns

array|boolean
Array containing name of the folder and UID of the message stored, or bool in case of failure.

Throws

CApiInvalidArgumentException
public
# appendMessageFromFile( CAccount $oAccount, string $sMessageFileName, string $sFolderToAppend )

Appends message from file to a specific folder.

Appends message from file to a specific folder.

Parameters

$oAccount
Account object.
$sMessageFileName
Path to .eml file.
$sFolderToAppend
Folder the message is appended to.
public
# appendMessageFromStream( CAccount $oAccount, resource $rMessage, string $sFolder, integer $iStreamSize )

Appends message from stream to a specific folder.

Appends message from stream to a specific folder.

Parameters

$oAccount
Account object.
$rMessage
Resource the message is appended from.
$sFolder
Folder the message is appended to.
$iStreamSize
Size of stream.
public true
# setMessageFlag( CAccount $oAccount, string $sFolderFullNameRaw, array $aUids, string $sFlagString, integer $iAction = EMailMessageStoreAction::Add, boolean $bSetToAll = false, boolean $bSkipNonPermanentsFlags = false )

Sets, removes or toggles flags of one or several messages.

Sets, removes or toggles flags of one or several messages.

Parameters

$oAccount
Account object.
$sFolderFullNameRaw
Raw full name of the folder.
$aUids
List of message UIDs .
$sFlagString
String holding a list of flags to be modified.
$iAction
= EMailMessageStoreAction::Add. Flag triggering mode.
$bSetToAll
= false. If true flags will be applied to all messages in folder.
$bSkipNonPermanentsFlags
= false. If true flags wich is not permanent will be skipped.

Returns

true

Throws

CApiInvalidArgumentException
public integer|null
# getMessageUid( CAccount $oAccount, string $sFolderName, string $sMessageId )

Searches for a message with a specific Message-ID value and returns it's uid.

Searches for a message with a specific Message-ID value and returns it's uid.

Parameters

$oAccount
Account object.
$sFolderName
Name of the folder to look for message in.
$sMessageId
Message-ID value of the message.

Returns

integer|null
Integer message UID if the message was found, null otherwise.
public array|boolean
# getQuota( CAccount $oAccount )

Retrieves quota information for the account.

Retrieves quota information for the account.

Parameters

$oAccount
Account object.

Returns

array|boolean
Array of quota velues or bool if the information is unavailable.
public CApiMailMessage
# getMessage( CAccount $oAccount, string $sFolderFullNameRaw, integer $iUid, string $sRfc822SubMimeIndex = '', boolean $bParseICalAndVcard = false, boolean $bParseAsc = false, integer $iBodyTextLimit = 0 )

Downloads message from IMAP and returns it.

Downloads message from IMAP and returns it.

Parameters

$oAccount
Account object.
$sFolderFullNameRaw
Raw full name of the Folder.
$iUid
UID of the message to download.
$sRfc822SubMimeIndex
= ''. Index at which a message is taken to parse. Index is used if the message is another message attachment.
$bParseICalAndVcard
= false. If true ical and vcard attachments will be parsed.
$bParseAsc
= false. If true attachments with extension .asc will be parsed.
$iBodyTextLimit
= 0. If > 0 will be received only part of the message body. If = 0 the message body is not limited.

Returns

CApiMailMessage

Throws

CApiInvalidArgumentException
public boolean
# directMessageToStream( CAccount $oAccount, mixed $mCallback, string $sFolderName, integer $iUid, string $sMimeIndex = '' )

This is universal function for obtaining any MIME data via stream.

This is universal function for obtaining any MIME data via stream.

Parameters

$oAccount
Account object.
$mCallback
This callback accepts the following parameters: $rMessageMimeIndexStream, $sContentType, $sFileName, $sMimeIndex.
$sFolderName
Folder the message resides in.
$iUid
UID of the message we're working with.
$sMimeIndex
= ''. Mime index of message part.

Returns

boolean

Throws

MailSo\Base\Exceptions\InvalidArgumentException
MailSo\Net\Exceptions\Exception
MailSo\Imap\Exceptions\Exception
public integer
# __sortHelper( type $a, type $b, type $aSortUidsFlipped )

Compares items for sorting.

Compares items for sorting.

Parameters

$a
First item to compare.
$b
Second item to compare.
$aSortUidsFlipped
Array contains items to compare.

Returns

integer
public CApiMailMessageCollection
# getMessageList( CAccount $oAccount, string $sFolderFullNameRaw, integer $iOffset = 0, integer $iLimit = 20, string $sSearch = '', boolean $bUseThreads = false, array $aFilters = array(), string $sInboxUidnext = '' )

Obtains message list with messages data.

Obtains message list with messages data.

Parameters

$oAccount
Account object.
$sFolderFullNameRaw
Raw full name of the folder.
$iOffset
= 0. Offset value for obtaining a partial list.
$iLimit
= 20. Limit value for obtaining a partial list.
$sSearch
= ''. Search text.
$bUseThreads
= false. If true, message list will be returned in threaded mode.
$aFilters
= array(). Contains filters for searching of messages.
$sInboxUidnext
= ''. Uidnext value of Inbox folder.

Returns

CApiMailMessageCollection

Throws

CApiInvalidArgumentException
public CApiMailMessageCollection
# getMessageListByUids( CAccount $oAccount, string $sFolderFullNameRaw, array $aUids )

Obtains a list of specific messages.

Obtains a list of specific messages.

Parameters

$oAccount
Account object.
$sFolderFullNameRaw
Raw full name of the folder.
$aUids
List of message UIDs.

Returns

CApiMailMessageCollection

Throws

CApiInvalidArgumentException
public CApiMailMessageCollection
# getMessagesFlags( CAccount $oAccount, string $sFolderFullNameRaw, array $aUids )

Obtains list of flags for one or several messages.

Obtains list of flags for one or several messages.

Parameters

$oAccount
Account object.
$sFolderFullNameRaw
Raw full name of the folder.
$aUids
List of message UIDs.

Returns

CApiMailMessageCollection

Throws

CApiInvalidArgumentException
public array
# getMessagesForHelpdeskSynch( CAccount $oAccount, integer $iUidFrom, integer & $iLastUid = 0, integer $iLimit = 5 )

Obtains messages for helpdesk synchronization with mailbox.

Obtains messages for helpdesk synchronization with mailbox.

Parameters

$oAccount
Account object.
$iUidFrom
Starts obtaining from this uid.
$iLastUid
= 0 Returns last uid by reference.
$iLimit
= 5 Messages count for obtaining.

Returns

array

Throws

CApiInvalidArgumentException

Properties summary

protected array $aImapClientCache

List of ImapClient objects.

List of ImapClient objects.

#
AfterLogic API Documentation API documentation generated by ApiGen