IMP_Sentmail_Mongo
extends IMP_Sentmail
in package
implements
Horde_Mongo_Collection_Index
Sentmail driver implementation for MongoDB databases.
Tags
Table of Contents
Interfaces
- Horde_Mongo_Collection_Index
Constants
- ACTION = 'action'
- FORWARD = 'forward'
- MDN = 'mdn'
- MESSAGEID = 'msgid'
- NEWMSG = 'new'
- RECIPIENT = 'recip'
- REDIRECT = 'redirect'
- REPLY = 'reply'
- SUCCESS = 'success'
- TS = 'ts'
- WHO = 'who'
Properties
- $limit_period : int
- $threshold : int
- $_db : MongoCollection
- Handle for the current database connection.
- $_indices : array<string|int, mixed>
- Indices list.
- $_params : array<string|int, mixed>
- Hash containing configuration parameters.
Methods
- __construct() : mixed
- Constructor.
- __get() : mixed
- checkMongoIndices() : mixed
- createMongoIndices() : mixed
- favouriteRecipients() : array<string|int, mixed>
- Returns the favourite recipients.
- gc() : mixed
- Garbage collect log entries.
- log() : mixed
- Logs an attempt to send a message.
- numberOfRecipients() : int
- Returns the number of recipients within a certain time period.
- _deleteOldEntries() : mixed
- Deletes all log entries older than a certain date.
- _log() : mixed
- Logs an attempt to send a message per recipient.
Constants
ACTION
public
mixed
ACTION
= 'action'
FORWARD
public
mixed
FORWARD
= 'forward'
MDN
public
mixed
MDN
= 'mdn'
MESSAGEID
public
mixed
MESSAGEID
= 'msgid'
NEWMSG
public
mixed
NEWMSG
= 'new'
RECIPIENT
public
mixed
RECIPIENT
= 'recip'
REDIRECT
public
mixed
REDIRECT
= 'redirect'
REPLY
public
mixed
REPLY
= 'reply'
SUCCESS
public
mixed
SUCCESS
= 'success'
TS
public
mixed
TS
= 'ts'
WHO
public
mixed
WHO
= 'who'
Properties
$limit_period read-only
public
int
$limit_period
If limiting recipients per time period, how many hours should this period last?
$threshold read-only
public
int
$threshold
How many days should old log entries be kept?
$_db
Handle for the current database connection.
protected
MongoCollection
$_db
$_indices
Indices list.
protected
array<string|int, mixed>
$_indices
= array('index_ts' => array(self::TS => 1), 'index_who' => array(self::WHO => 1), 'index_success' => array(self::SUCCESS => 1))
$_params
Hash containing configuration parameters.
protected
array<string|int, mixed>
$_params
= array()
Methods
__construct()
Constructor.
public
__construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $params : array<string|int, mixed> = array()
-
Parameters:
- collection: (string) The name of the sentmail collection.
- mongo_db: (Horde_Mongo_Client) [REQUIRED] The DB instance.
__get()
public
__get(mixed $name) : mixed
Parameters
- $name : mixed
checkMongoIndices()
public
checkMongoIndices() : mixed
createMongoIndices()
public
createMongoIndices() : mixed
favouriteRecipients()
Returns the favourite recipients.
public
favouriteRecipients(mixed $limit[, mixed $filter = null ]) : array<string|int, mixed>
Parameters
- $limit : mixed
-
Return this number of recipients.
- $filter : mixed = null
-
A list of messages types that should be returned. Null returns all message types.
Return values
array<string|int, mixed> —A list with the $limit most favourite recipients.
gc()
Garbage collect log entries.
public
gc() : mixed
log()
Logs an attempt to send a message.
public
log(int $action, string $message_id, string|array<string|int, mixed> $recipients[, bool $success = true ]) : mixed
Parameters
- $action : int
-
Why the message was sent (IMP_Sentmail constant).
- $message_id : string
-
The Message-ID.
- $recipients : string|array<string|int, mixed>
-
The list of message recipients.
- $success : bool = true
-
Whether the attempt was successful.
numberOfRecipients()
Returns the number of recipients within a certain time period.
public
numberOfRecipients(mixed $hours[, mixed $user = false ]) : int
Parameters
- $hours : mixed
-
Time period in hours.
- $user : mixed = false
-
Return the number of recipients for the current user?
Return values
int —The number of recipients in the given time period.
_deleteOldEntries()
Deletes all log entries older than a certain date.
protected
_deleteOldEntries(mixed $before) : mixed
Parameters
- $before : mixed
-
Unix timestamp before that all log entries should be deleted.
_log()
Logs an attempt to send a message per recipient.
protected
_log(mixed $action, mixed $message_id, mixed $recipient, mixed $success) : mixed
Parameters
- $action : mixed
-
Why the message was sent (IMP_Sentmail constant).
- $message_id : mixed
-
The Message-ID.
- $recipient : mixed
-
A message recipient.
- $success : mixed
-
Whether the attempt was successful.