EmailServiceInterface
in
Interface EmailServiceInterface
Tags
Table of Contents
- create() : EmailInterface
- Creates a new email
- delete() : mixed
- Removes an email from the database.
- deleteCollection() : mixed
- Deletes a collection of emails.
- deleteEmailsByCustomerEmail() : mixed
- Removes all emails from the data base that have the given email address as sender or recipient.
- deleteOldEmailsByDate() : mixed
- Deletes all emails that have creation date below the give date.
- filter() : EmailCollection
- Filters email records with provided keyword string.
- findById() : EmailInterface|null
- Finds an email by ID.
- getAll() : EmailCollection
- Returns all email records from the database.
- getById() : EmailInterface
- Returns an email by id.
- getEmailsByCustomerEmail() : EmailCollection
- Gets all emails from the data base that have the given email address as sender or recipient.
- getPending() : EmailCollectionInterface
- Return pending email records as an email collection.
- getRecordCount() : int
- Returns the current count of the email records in the database.
- getSent() : EmailCollectionInterface
- Returns sent email records as an email collection.
- queue() : mixed
- Saves an email as pending (will not be sent).
- queueCollection() : mixed
- Queues a collection of emails.
- send() : mixed
- Sends and saves an email.
- sendCollection() : mixed
- Sends a collection of emails.
- sendPending() : mixed
- Sends pending email records.
- validateEmailAddress() : bool
- Validate a string email address.
- write() : mixed
- Writes an email instance to the DB.
- writeCollection() : mixed
- Writes a collection of emails into database.
Methods
create()
Creates a new email
public
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.
Parameters
- $sender : EmailContactInterface
-
Contains the sender information.
- $recipient : EmailContactInterface
-
Contains the recipient information.
- $subject : EmailSubjectInterface
-
Email record subject.
- $content : EmailContentInterface = null
-
(optional) Html content of the email.
Return values
EmailInterface —Valid email.
delete()
Removes an email from the database.
public
delete(EmailInterface $email) : mixed
Parameters
- $email : EmailInterface
-
Contains the email information.
Return values
mixed —deleteCollection()
Deletes a collection of emails.
public
deleteCollection(EmailCollectionInterface $collection) : mixed
Parameters
- $collection : EmailCollectionInterface
-
Email collection to delete.
Return values
mixed —deleteEmailsByCustomerEmail()
Removes all emails from the data base that have the given email address as sender or recipient.
public
deleteEmailsByCustomerEmail(CustomerEmail $email) : mixed
Parameters
- $email : CustomerEmail
-
E-Mail address.
Return values
mixed —deleteOldEmailsByDate()
Deletes all emails that have creation date below the give date.
public
deleteOldEmailsByDate(DateTime $date) : mixed
Parameters
- $date : DateTime
Return values
mixed —filter()
Filters email records with provided keyword string.
public
filter(string $p_keyword[, array<string|int, mixed> $limit = [] ][, array<string|int, mixed> $order = [] ]) : EmailCollection
Parameters
- $p_keyword : string
-
String to be used for filtering the email records.
- $limit : array<string|int, mixed> = []
-
(optional) Array that contains LIMIT and OFFSET value e.g. array( 'limit' => 10, 'offset' => 5 )
- $order : array<string|int, mixed> = []
-
(optional) Contains arrays with column, direction pairs e.g. array( 'column' => 'direction' )
Return values
EmailCollection —Email collection containing the email records.
findById()
Finds an email by ID.
public
findById(IdType $id) : EmailInterface|null
Parameters
- $id : IdType
-
The record ID that matches the email.
Return values
EmailInterface|null —Email or null if not found.
getAll()
Returns all email records from the database.
public
getAll() : EmailCollection
Return values
EmailCollection —Email records.
getById()
Returns an email by id.
public
getById(IdType $id) : EmailInterface
Parameters
- $id : IdType
-
The database ID that matches the email record.
Return values
EmailInterface —Contains the email information.
getEmailsByCustomerEmail()
Gets all emails from the data base that have the given email address as sender or recipient.
public
getEmailsByCustomerEmail(CustomerEmail $email) : EmailCollection
Parameters
- $email : CustomerEmail
-
E-Mail address.
Return values
EmailCollection —getPending()
Return pending email records as an email collection.
public
getPending() : EmailCollectionInterface
Return values
EmailCollectionInterface —The pending emails.
getRecordCount()
Returns the current count of the email records in the database.
public
getRecordCount([string $p_filterKeyword = '' ]) : int
Parameters
- $p_filterKeyword : string = ''
-
(optional) If provided the records will be filtered.
Return values
int —The row number of the email table.
getSent()
Returns sent email records as an email collection.
public
getSent() : EmailCollectionInterface
Return values
EmailCollectionInterface —Sent email records.
queue()
Saves an email as pending (will not be sent).
public
queue(EmailInterface $email) : mixed
Parameters
- $email : EmailInterface
-
Contains email information.
Return values
mixed —queueCollection()
Queues a collection of emails.
public
queueCollection(EmailCollectionInterface $collection) : mixed
Parameters
- $collection : EmailCollectionInterface
-
Email collection to queue.
Return values
mixed —send()
Sends and saves an email.
public
send(EmailInterface $email) : mixed
Parameters
- $email : EmailInterface
-
Contains email information.
Return values
mixed —sendCollection()
Sends a collection of emails.
public
sendCollection(EmailCollectionInterface $collection) : mixed
Parameters
- $collection : EmailCollectionInterface
-
Email collection to send.
Return values
mixed —sendPending()
Sends pending email records.
public
sendPending() : mixed
Return values
mixed —validateEmailAddress()
Validate a string email address.
public
validateEmailAddress(string $p_emailAddress) : bool
Parameters
- $p_emailAddress : string
-
Email address to be validated.
Return values
bool —Returns the validation result (true for success, false for failure).
write()
Writes an email instance to the DB.
public
write(EmailInterface $email) : mixed
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.
Parameters
- $email : EmailInterface
-
Email to write.
Return values
mixed —writeCollection()
Writes a collection of emails into database.
public
writeCollection(EmailCollectionInterface $collection) : mixed
Parameters
- $collection : EmailCollectionInterface
-
Email collection to write.