EmailServiceInterface

Extends

Interface EmailServiceInterface

category

System

package

Email

subpackage

Interfaces

Methods

Creates a new email

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.

Arguments

$sender

\EmailContactInterface

Contains the sender information.

$recipient

\EmailContactInterface

Contains the recipient information.

$subject

\EmailSubjectInterface

Email record subject.

$content

\EmailContentInterface

(optional) Html content of the email.

Response

\EmailInterface

Valid email.

Removes an email from the database.

delete(\EmailInterface $email) 

Arguments

$email

\EmailInterface

Contains the email information.

Deletes a collection of emails.

deleteCollection(\EmailCollectionInterface $collection) 

Arguments

$collection

\EmailCollectionInterface

Email collection to delete.

Removes all emails from the data base that have the given email address as sender or recipient.

deleteEmailsByCustomerEmail(\CustomerEmail $email) 

Arguments

$email

\CustomerEmail

E-Mail address.

Deletes all emails that have creation date below the give date.

deleteOldEmailsByDate(\DateTime $date) 

Arguments

$date

\DateTime

Filters email records with provided keyword string.

filter(string $p_keyword, array $limit = array(), array $order = array()) : \EmailCollection

Arguments

$p_keyword

string

String to be used for filtering the email records.

$limit

array

(optional) Array that contains LIMIT and OFFSET value e.g. array( 'limit' => 10, 'offset' => 5 )

$order

array

(optional) Contains arrays with column, direction pairs e.g. array( 'column' => 'direction' )

Response

\EmailCollection

Email collection containing the email records.

Finds an email by ID.

findById(\IdType $id) : \EmailInterface|null

Arguments

$id

\IdType

The record ID that matches the email.

Response

\EmailInterface|null

Email or null if not found.

Returns all email records from the database.

getAll() : \EmailCollection

Response

\EmailCollection

Email records.

Returns an email by id.

getById(\IdType $id) : \EmailInterface

Arguments

$id

\IdType

The database ID that matches the email record.

Response

\EmailInterface

Contains the email information.

Gets all emails from the data base that have the given email address as sender or recipient.

getEmailsByCustomerEmail(\CustomerEmail $email) : \EmailCollection

Arguments

$email

\CustomerEmail

E-Mail address.

Response

\EmailCollection

Return pending email records as an email collection.

getPending() : \EmailCollectionInterface

Response

\EmailCollectionInterface

The pending emails.

Returns the current count of the email records in the database.

getRecordCount(string $p_filterKeyword = '') : integer

Arguments

$p_filterKeyword

string

(optional) If provided the records will be filtered.

Response

integer

The row number of the email table.

Returns sent email records as an email collection.

getSent() : \EmailCollectionInterface

Response

\EmailCollectionInterface

Sent email records.

Saves an email as pending (will not be sent).

queue(\EmailInterface $email) 

Arguments

$email

\EmailInterface

Contains email information.

Queues a collection of emails.

queueCollection(\EmailCollectionInterface $collection) 

Arguments

$collection

\EmailCollectionInterface

Email collection to queue.

Sends and saves an email.

send(\EmailInterface $email) 

Arguments

$email

\EmailInterface

Contains email information.

Sends a collection of emails.

sendCollection(\EmailCollectionInterface $collection) 

Arguments

$collection

\EmailCollectionInterface

Email collection to send.

Sends pending email records.

sendPending() 

Validate a string email address.

validateEmailAddress(string $p_emailAddress) : boolean

Arguments

$p_emailAddress

string

Email address to be validated.

Response

boolean

Returns the validation result (true for success, false for failure).

Writes an email instance to the DB.

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.

Arguments

$email

\EmailInterface

Email to write.

Writes a collection of emails into database.

writeCollection(\EmailCollectionInterface $collection) 

Arguments

$collection

\EmailCollectionInterface

Email collection to write.