Modules/Groupware/Email/Letterman.php
\Conjoon_Modules_Groupware_Email_Letterman
A utility class for fetching/sending emails.
- Author
- Thorsten-Suckow-Homberg
- Category
Constants
Properties
Methods

_assignFolderId(
integer $userId, integer $accountId, $emailItem
)
:
voidAssigns a folder id to the fetched email.
| Name | Type | Description |
|---|---|---|
| $userId | integer | |
| $accountId | integer | |
| $emailItem |
- Oaram
- array $emailItem
- Todo
- implement logic, think about creating a filter from it

_assignJunkStatus(
$userId, $emailItem
)
:
voidChecks wether the email should be marked as spam.
| Name | Type | Description |
|---|---|---|
| $userId | ||
| $emailItem |
- Todo
- implement logic, think about creating filter from it

_cacheUidl(
array $uidList, integer $accountId, integer $chunks
=
20
)
:
voidCaches 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] )
| 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 |

_computeChunkSize(
integer $number
)
:
integerStrategyfor 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.
| Name | Type | Description |
|---|---|---|
| $number | integer |
| Type | Description |
|---|---|
| integer |

_decode(
$text, $encodingInformation
)
:
void| Name | Type | Description |
|---|---|---|
| $text | ||
| $encodingInformation |

_fetchEmails(
int $userId, $account
)
:
Array| Name | Type | Description |
|---|---|---|
| $userId | int | The id of the user to process the email-accounts for. |
| $account |
| 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'. |

_isMessageIdPresent(
string $messageId, integer $accountId, string $rawHeader, string $rawBody
)
:
booleanChecks 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.
| 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. |
| Type | Description |
|---|---|
| boolean | true, if a message with the specified message-id/hash is already stored in the db for this account, otherwise false |

_isUidPresent(
integer $accountId, string $uid
)
:
booleanChecks wether a message with a uid is already present in the db.
| 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 |
| Type | Description |
|---|---|
| boolean | true, if a message with the specified uid is already stored in the db for this account, otherwise false |

_parseMultipartAlternative(
$message, $emailItem
)
:
void| Name | Type | Description |
|---|---|---|
| $message | ||
| $emailItem |

_parseMultipartMixed(
$message, $emailItem
)
:
void| Name | Type | Description |
|---|---|---|
| $message | ||
| $emailItem |

_parseMultipartRelated(
$message, $emailItem
)
:
void| Name | Type | Description |
|---|---|---|
| $message | ||
| $emailItem |

_parseMultipartReport(
$message, $emailItem
)
:
void| Name | Type | Description |
|---|---|---|
| $message | ||
| $emailItem |

_parseMultipartSigned(
$message, $emailItem
)
:
void| Name | Type | Description |
|---|---|---|
| $message | ||
| $emailItem |

_saveEmail(
array $emailItem
)
:
mixedSaves 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.
| 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 |
| Type | Description |
|---|---|
| mixed | Return the id of the last inserted email item, or an error message if an error occured. |

_setIconvEncoding(
string $type
)
:
voidSets 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.
| Name | Type | Description |
|---|---|---|
| $type | string |

_splitMessage(
string $message, string $header, string $body, string $EOL
=
Zend_Mime::LINEEND
)
:
voidSplits a message into its header and its body, writing the results into $hader and $body
| 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} |

fetchEmails(
int $userId, int $accountId
)
:
arrayLooks up the singleton instance for this class and returns the return value from _fetchEmails
| 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 |
| Type | Description |
|---|---|
| array |