class Attachments

Supports attachment processing for MailerService.

Constants

MIME_TYPES

Array of supported mime types as uploads.

Methods

static Email
attach(array $attachment, Email $email)

Processes attachment if key labeled content is found.

static Email
attachFromPath(array $attachment, Email $email)

Processes attachment if key labeled path is found.

static array
content(EmailAttachments $attachment)

Used to assemble array for attachment when content key is used.

static array
getAllowedMimeTypes()

Gets the values from the MIME_TYPES array.

static string
mime(string $ext)

Returns the MIME type for a given file extension.

static array
path(EmailAttachments $attachment)

Used to assemble array for attachment when path key is used.

static Email
processAttachments(array $attachments, Email $email)

Process attachments to be sent.

Details

at line 55
static protected Email attach(array $attachment, Email $email)

Processes attachment if key labeled content is found.

Parameters

array $attachment

The attachment.

Email $email

The Email to be sent.

Return Value

Email

$email The Email to be sent after attachments have been processed.

at line 71
static protected Email attachFromPath(array $attachment, Email $email)

Processes attachment if key labeled path is found.

Parameters

array $attachment

The attachment.

Email $email

The Email to be sent.

Return Value

Email

$email The Email to be sent after attachments have been processed.

at line 85
static array content(EmailAttachments $attachment)

Used to assemble array for attachment when content key is used.

Parameters

EmailAttachments $attachment

Instance of the EmailAttachment model.

Return Value

array

The full path to the file.

at line 104
static array getAllowedMimeTypes()

Gets the values from the MIME_TYPES array.

Return Value

array

The values from the MIME_TYPES array.

at line 114
static string mime(string $ext)

Returns the MIME type for a given file extension.

Parameters

string $ext

File extension (e.g., 'pdf', 'jpg', 'docx')

Return Value

string

The corresponding MIME type or 'application/octet-stream'

at line 124
static array path(EmailAttachments $attachment)

Used to assemble array for attachment when path key is used.

Parameters

EmailAttachments $attachment

Instance of the EmailAttachment model.

Return Value

array

The data needed to assemble an attachment.

at line 146
static Email processAttachments(array $attachments, Email $email)

Process attachments to be sent.

Parameters

array $attachments

The array of attachments.

Email $email

The Email to be sent.

Return Value

Email

$email The Email to be sent after attachments have been processed.