Class EmailService
Represents the public API for the Email service of the system. External users must use this class for all the email operations except.
Important: Since the attachments will be flat-stored in the "uploads/attachmetns" directory the "send" and "queue" method will have to perform multiple writes to the database in order to get robust attachment handling that will not crash the rest of the service.
category |
System |
---|---|
package |
|
__construct(\EmailRepositoryInterface $repository, \EmailFactoryInterface $factory, \MailerAdapterInterface $mailerAdapter, \AttachmentsHandlerInterface $attachmentsHandler)
create(\EmailContactInterface $sender, \EmailContactInterface $recipient, \EmailSubjectInterface $subject, \EmailContentInterface $content = null) : \EmailInterface
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.
\EmailInterface
Valid email.
delete(\EmailInterface $email)
deleteCollection(\EmailCollectionInterface $collection)
deleteEmailsByCustomerEmail(\CustomerEmail $email)
deleteOldEmailsByDate(\DateTime $date)
\DateTime
filter(string $p_keyword, array $limit = array(), array $order = array()) : \EmailCollection
string
String to be used for filtering the email records.
array
(optional) Array that contains LIMIT and OFFSET value e.g. array( 'limit' => 10, 'offset' => 5 )
array
(optional) Contains arrays with column, direction pairs e.g. array( 'column' => 'direction' )
\EmailCollection
Email collection containing the email records.
findById(\IdType $id) : \EmailInterface|null
getAll() : \EmailCollection
getById(\IdType $id) : \EmailInterface
getEmailsByCustomerEmail(\CustomerEmail $email) : \EmailCollection
getPending() : \EmailCollectionInterface
getRecordCount(string $p_filterKeyword = '') : integer
string
(optional) If provided the records will be filtered.
integer
The row number of the email table.
getSent() : \EmailCollectionInterface
queue(\EmailInterface $email)
queueCollection(\EmailCollectionInterface $collection)
send(\EmailInterface $email)
sendCollection(\EmailCollectionInterface $collection)
sendPending()
validateEmailAddress(string $p_emailAddress) : boolean
Throws |
|
---|
string
Email address to be validated.
boolean
Returns the validation result (true for success, false for failure).
write(\EmailInterface $email)
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.
writeCollection(\EmailCollectionInterface $collection)