master

laravel/framework

Last updated at: 29/12/2023 09:21

MailQueue.php

TLDR

This file defines an interface MailQueue in the Illuminate\Contracts\Mail namespace. It contains two methods that can be implemented by classes that want to provide mail queue functionality.

Methods

queue($view, $queue = null)

This method queues a new email message for sending. It takes two parameters:

  • $view: Can be an instance of Mailable, a string representing a view name, or an array of view names.
  • $queue (optional): The name of the queue to which the email should be added. If not provided, the email will be added to the default queue.

later($delay, $view, $queue = null)

This method queues a new email message for sending after a certain delay. It takes three parameters:

  • $delay: The delay before the email should be sent. Can be an instance of DateTimeInterface, a DateInterval, or an integer representing the number of seconds.
  • $view: Can be an instance of Mailable, a string representing a view name, or an array of view names.
  • $queue (optional): The name of the queue to which the email should be added. If not provided, the email will be added to the default queue.
<?php

namespace Illuminate\Contracts\Mail;

interface MailQueue
{
    /**
     * Queue a new e-mail message for sending.
     *
     * @param  \Illuminate\Contracts\Mail\Mailable|string|array  $view
     * @param  string|null  $queue
     * @return mixed
     */
    public function queue($view, $queue = null);

    /**
     * Queue a new e-mail message for sending after (n) seconds.
     *
     * @param  \DateTimeInterface|\DateInterval|int  $delay
     * @param  \Illuminate\Contracts\Mail\Mailable|string|array  $view
     * @param  string|null  $queue
     * @return mixed
     */
    public function later($delay, $view, $queue = null);
}