AttachmentsHandlerInterface

Extends

Class AttachmentsHandlerInterface

category

System

package

Email

subpackage

Interfaces

Methods

Process email attachments.

backupEmailAttachments(\EmailInterface &$email) 

This method will move all the email attachments to the "uploads/attachments" directory and store them there for future reference and history navigation purposes. The email needs to be saved first because the email ID will be used to distinguish the emails.

Arguments

$email

\EmailInterface

Passed by reference, contains the email data.

Removes a single email attachment.

deleteAttachment(\EmailAttachmentInterface $attachment) 

Arguments

$attachment

\EmailAttachmentInterface

E-Mail attachment.

Deletes email attachments.

deleteEmailAttachments(\EmailInterface $email) 

This method will remove all the email attachments from the server.

Arguments

$email

\EmailInterface

Contains the email information.

Delete attachments for each email in collection.

deleteEmailCollection(\EmailCollectionInterface $collection) 

Every email has its own attachments directory. When emails are deleted we need to remove their respective attachments.

deprecated

Since v2.3.3.0 this method is marked as deprecated and will be removed from the class.

Arguments

$collection

\EmailCollectionInterface

Contains email records to be deleted.

Delete old attachments prior to removal date.

deleteOldAttachments(\DateTime $removalDate) : array

This method will remove all the files and directories that are prior to the given date. It will return removal information so that user can see how much disc spaces was set free.

Arguments

$removalDate

\DateTime

From this date and before the attachment files will be removed.

Response

array

Returns an array which contains the "count" and "size" values or the operation.

Removes all files within the "uploads/tmp" directory.

emptyTempDirectory() 

There might be cases where old unused files are left within the "tmp" directory and they need to be deleted. This function will remove all these files.

Get attachments directory file size in bytes.

getAttachmentsSize() : integer

Response

integer

Returns the size in bytes.

Upload an attachment to "uploads/tmp" directory.

uploadAttachment(\EmailAttachmentInterface $attachment) : \EmailAttachment

This method takes the uploaded file information and places it in the "uploads/tmp" directory as a temporary place, until the "uploadEmailCollection" moves it to the final destination.

Arguments

$attachment

\EmailAttachmentInterface

Contains the file information (path is required).

Response

\EmailAttachment

Returns an EmailAttachment instance with the new attachment path.

Process attachments for each email in collection.

uploadEmailCollection(\EmailCollectionInterface $collection) 

Important! Use this method after you save the emails into the database. The reason is that this property separates each attachment file by its email ID, a value that is only accessible after the email is already saved.

deprecated

Since v2.3.3.0 this method is marked as deprecated and will be removed from the class.

Arguments

$collection

\EmailCollectionInterface

Passed by reference, contains emails of which the attachments must be processed.