1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
<?php
/* --------------------------------------------------------------
EmailServiceInterface.inc.php 2015-02-05 gm
Gambio GmbH
http://www.gambio.de
Copyright (c) 2015 Gambio GmbH
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------
*/
/**
* Interface EmailServiceInterface
*
* @category System
* @package Email
* @subpackage Interfaces
*/
interface EmailServiceInterface
{
/**
* Creates a new email
*
* Use this method to can a valid email object that can be sent without any
* additional modification. Optionally you can add more information to the
* email object such as attachments, BCC & CC contacts etc.
*
* @param EmailContactInterface $sender Contains the sender information.
* @param EmailContactInterface $recipient Contains the recipient information.
* @param EmailSubjectInterface $subject Email record subject.
* @param EmailContentInterface $content (optional) Html content of the email.
*
* @return EmailInterface Valid email.
*/
public function create(EmailContactInterface $sender,
EmailContactInterface $recipient,
EmailSubjectInterface $subject,
EmailContentInterface $content = null);
/**
* Sends and saves an email.
*
* @param EmailInterface $email Contains email information.
*/
public function send(EmailInterface $email);
/**
* Saves an email as pending (will not be sent).
*
* @param EmailInterface $email Contains email information.
*/
public function queue(EmailInterface $email);
/**
* Writes an email instance to the DB.
*
* This method will store an email entity just the way it is without modifying other properties
* like the "send" or "queue" methods do. If you use this method or the "writeCollection" make
* sure that all the email properties are the desired ones.
*
* @param EmailInterface $email Email to write.
*/
public function write(EmailInterface $email);
/**
* Returns an email by id.
*
* @param IdType $id The database ID that matches the email record.
*
* @return EmailInterface Contains the email information.
*/
public function getById(IdType $id);
/**
* Finds an email by ID.
*
* @param IdType $id The record ID that matches the email.
*
* @return EmailInterface|null Email or null if not found.
*/
public function findById(IdType $id);
/**
* Removes an email from the database.
*
* @param EmailInterface $email Contains the email information.
*/
public function delete(EmailInterface $email);
/**
* Filters email records with provided keyword string.
*
* @param string $p_keyword String to be used for filtering the email records.
* @param array $limit (optional) Array that contains LIMIT and OFFSET value
* e.g. array( 'limit' => 10, 'offset' => 5 )
* @param array $order (optional) Contains arrays with column, direction pairs
* e.g. array( 'column' => 'direction' )
*
* @return EmailCollection Email collection containing the email records.
*/
public function filter($p_keyword, array $limit = array(), array $order = array());
/**
* Validate a string email address.
*
* @param string $p_emailAddress Email address to be validated.
*
* @return bool Returns the validation result (true for success, false for failure).
*/
public function validateEmailAddress($p_emailAddress);
/**
* Sends pending email records.
*/
public function sendPending();
/**
* Return pending email records as an email collection.
*
* @return EmailCollectionInterface The pending emails.
*/
public function getPending();
/**
* Returns sent email records as an email collection.
*
* @return EmailCollectionInterface Sent email records.
*/
public function getSent();
/**
* Returns all email records from the database.
*
* @return EmailCollection Email records.
*/
public function getAll();
/**
* Sends a collection of emails.
*
* @param EmailCollectionInterface $collection Email collection to send.
*/
public function sendCollection(EmailCollectionInterface $collection);
/**
* Queues a collection of emails.
*
* @param EmailCollectionInterface $collection Email collection to queue.
*/
public function queueCollection(EmailCollectionInterface $collection);
/**
* Writes a collection of emails into database.
*
* @param EmailCollectionInterface $collection Email collection to write.
*/
public function writeCollection(EmailCollectionInterface $collection);
/**
* Deletes a collection of emails.
*
* @param EmailCollectionInterface $collection Email collection to delete.
*/
public function deleteCollection(EmailCollectionInterface $collection);
/**
* Returns the current count of the email records in the database.
*
* @param string $p_filterKeyword (optional) If provided the records will be filtered.
*
* @return int The row number of the email table.
*/
public function getRecordCount($p_filterKeyword = '');
}