Skip to content

Queue API ​

Available from v2.0.0

Other add-ons can add an email to the queue directly, without sending it through ee()->email with a marker.

php
$email_id = ee('reinos_email_queue:Queue')->add([
    'from_email' => 'info@example.com',
    'from_name' => 'Example',
    'recipients' => 'john@example.com',
    'cc' => ['jane@example.com'],
    'bcc' => '',
    'subject' => 'Hello',
    'body' => '<p>Hello John</p>',
    'mailtype' => 'html',
    'reply_to_email' => 'support@example.com',
    'reply_to_name' => 'Support',
    'alt_message' => 'Hello John',
    'attachments' => [
        '/path/to/file.pdf',
        ['path' => '/path/to/other.pdf', 'name' => 'invoice.pdf'],
    ],
]);
KeyDescription
from_emailRequired. The from address.
from_nameThe from name.
recipients, cc, bccA comma separated string or an array of addresses. At least one of them is required.
subjectThe subject.
bodyThe body of the email.
mailtypetext (default) or html.
reply_to_email, reply_to_nameThe reply-to address and name.
alt_messageThe plain text alternative of an HTML email.
attachmentsA list of file paths, or arrays with a path and optionally a name and disposition (attachment or inline).

The method returns the ID of the queued email, or false when the email has no from address or recipients.

Attachments ​

Attachments are copied to system/user/reinos_email_queue_attachments/ when the email is queued, so the original files can be removed directly after queuing. The copies are removed when the email is sent or deleted from the queue.

Email Template ​

The queue stores an email after the Email Template add-on wrapped it in its template. When the queue sends the email, it adds {do_not_parse} to the body, so Email Template does not wrap it a second time. Emails added with this API are not sent through ee()->email when they are queued, so they are sent without the template.