Modules/Groupware/Email/Letterman.php

Show: inherited
Table of Contents

\Conjoon_Modules_Groupware_Email_Letterman

Package: Conjoon\Modules\Groupware\Conjoon\Modules\Groupware\Email

A utility class for fetching/sending emails.

Author
Thorsten-Suckow-Homberg  
Category
Email  

Constants

Constant  ICONV_OLD = 'old'
Constant  ICONV_UTF_8 = 'UTF-8'

Properties

Propertyprivateinteger  $_attachmentCounter= '1'

Default value1Details
Type
integer
Propertyprivate  $_attachmentFacade= 'null'
Default valuenullDetails
Type
n/a
Propertyprivate  $_cachedUidList= 'array()'
Default valuearray()Details
Type
n/a
Propertyprivate  $_filterAttachment= 'null'
Default valuenullDetails
Type
n/a
Propertyprivate  $_filterFlag= 'null'
Default valuenullDetails
Type
n/a
Propertyprivate  $_filterInbox= 'null'
Default valuenullDetails
Type
n/a
Propertyprivate  $_filterItem= 'null'
Default valuenullDetails
Type
n/a
Propertyprivate\Conjoon_Modules_Groupware_Email_Letterman  $_instance= ''
static

Propertyprivate  $_lastIconvError= 'false'
Default valuefalseDetails
Type
n/a
Propertyprivate  $_maxAllowedPacket= '0'
Default value0Details
Type
n/a
Propertyprivate  $_maxMemory= '0'
Default value0Details
Type
n/a
Propertyprivate  $_modelAttachment= 'null'
Default valuenullDetails
Type
n/a
Propertyprivate  $_modelFlag= 'null'
Default valuenullDetails
Type
n/a
Propertyprivate  $_modelFolder= 'null'
Default valuenullDetails
Type
n/a
Propertyprivate  $_modelInbox= 'null'
Default valuenullDetails
Type
n/a
Propertyprivate  $_modelItem= 'null'
Default valuenullDetails
Type
n/a
Propertyprivatearray  $_oldEncodings= 'array()'
static

Default valuearray()Details
Type
array

Methods

methodprivate__construct( ) : void

Constructor.

Private to enforce singleton behavior.

methodprivate_assignFolderId( integer $userId, integer $accountId,  $emailItem ) : void

Assigns a folder id to the fetched email.

Parameters
Name Type Description
$userId integer
$accountId integer
$emailItem
Details
Oaram
array $emailItem  
Todo
implement logic, think about creating a filter from it  
methodprivate_assignJunkStatus(  $userId,  $emailItem ) : void

Checks wether the email should be marked as spam.

Parameters
Name Type Description
$userId
$emailItem
Details
Todo
implement logic, think about creating filter from it  
methodprivate_cacheUidl( array $uidList, integer $accountId, integer $chunks = 20 ) : void

Caches the uid list as returned by the server, by querying chunks of values against the db to look up already stored uids.

The uid-list is an assoc array with the key being the message number, and the value being the uid of this message, as generated by the server: ( [integer] => [string] )

Parameters
Name Type Description
$uidList array

The array containing the uids

$accountId integer

The id of the account to cache the uid-list for

$chunks integer

The number of uids to send to the server in one query, defaults to 20

methodprivate_computeChunkSize( integer $number ) : integer

Strategyfor computing the chunk size for _cacheUidl.

Depending on the passed argument, the returned value will be either a larger number to reduce calls to the database table.

Parameters
Name Type Description
$number integer
Returns
Type Description
integer
methodprivate_decode(  $text,  $encodingInformation ) : void

Parameters
Name Type Description
$text
$encodingInformation
methodprivate_fetchEmails( int $userId,  $account ) : Array

Parameters
Name Type Description
$userId int

The id of the user to process the email-accounts for.

$account
Returns
Type Description
Array An associative array with the keys of the fetched and saved emails in the array 'fetched', and error-messages in the key 'errors'.
methodprivate_getEncodingInformation(  $message ) : void

Parameters
Name Type Description
$message
methodprivate_getEncodingList( ) : void

methodprivate_iconvErrorHandler( ) : void

methodprivate_isMessageIdPresent( string $messageId, integer $accountId, string $rawHeader, string $rawBody ) : boolean

Checks wether a message with the specified message-id is already present in the db for this account.

If the supplied argument for message_id is empty, the method will try to check for uniqueness of this message based on the computed hash, as returned by Conjoon_Modules_Groupware_Email_Model_Inbox::computeMessageHash.

Parameters
Name Type Description
$messageId string

The message id to look up. Might be empty.

$accountId integer

The account id for which this message-id should be lokked up.

$rawHeader string

The unmodified, raw header of this message as returned by the server

$rawBody string

The unmodfied, raw body of this message as returned by the server, including attachments et all.

Returns
Type Description
boolean true, if a message with the specified message-id/hash is already stored in the db for this account, otherwise false
methodprivate_isUidPresent( integer $accountId, string $uid ) : boolean

Checks wether a message with a uid is already present in the db.

Parameters
Name Type Description
$accountId integer

The id of the account for hich the check has to be made.

$uid string

The server-generated uid to look up

Returns
Type Description
boolean true, if a message with the specified uid is already stored in the db for this account, otherwise false
methodprivate_parseAttachments(  $part,  $emailItem ) : void

Parameters
Name Type Description
$part
$emailItem
methodprivate_parseMultipartAlternative(  $message,  $emailItem ) : void

Parameters
Name Type Description
$message
$emailItem
methodprivate_parseMultipartMixed(  $message,  $emailItem ) : void

Parameters
Name Type Description
$message
$emailItem
methodprivate_parseMultipartRelated(  $message,  $emailItem ) : void

Parameters
Name Type Description
$message
$emailItem
methodprivate_parseMultipartReport(  $message,  $emailItem ) : void

Parameters
Name Type Description
$message
$emailItem
methodprivate_parseMultipartSigned(  $message,  $emailItem ) : void

Parameters
Name Type Description
$message
$emailItem
methodprivate_restoreErrorHandler( ) : void

methodprivate_saveEmail( array $emailItem ) : mixed

Saves the email and it's attachments. Uses the default db adapter as configured by the application. If an exception occurs, the exception's message will be stored in an array (together with other exceptions that may have occured) and returned later on. Any db operation that failed will be rolled back.

Parameters
Name Type Description
$emailItem array

An associative array with the data to insert into the different tables. All attachments will be stored in the key/value pair "attachments", which is itself a numeric array

Returns
Type Description
mixed Return the id of the last inserted email item, or an error message if an error occured.
methodprivate_setIconvEncoding( string $type ) : void
static

Sets the iconv-internal-encodings, since Zend_Mime does not allow for passing an indivdual charset for decoding.

This is a simple helper which allows for either setting the encoding to utf-8 or reset the endoding to the old value.

Parameters
Name Type Description
$type string
methodprivate_setIconvErrorHandler( ) : void

methodprivate_setPlainFromHtml(  $emailItem ) : void

Parameters
Name Type Description
$emailItem
methodprivate_splitMessage( string $message, string $header, string $body, string $EOL = Zend_Mime::LINEEND ) : void
static

Splits a message into its header and its body, writing the results into $hader and $body

Parameters
Name Type Description
$message string

The message to split

$header string

The var to store the header into

$body string

The var to store the body into

$EOL string

EOL string; defaults to {@link Zend_Mime::LINEEND}

methodpublicfetchEmails( int $userId, int $accountId ) : array
static

Looks up the singleton instance for this class and returns the return value from _fetchEmails

Parameters
Name Type Description
$userId int

The id of the user to process the email-accounts for.

$accountId int

The id of the account to fetch the emails for, or null to query all accounts

Returns
Type Description
array
Documentation was generated by DocBlox 0.18.1.