Mailer
class Mailer (View source)
Properties
protected Factory | $views | The view factory instance. |
|
protected Swift_Mailer | $swift | The Swift Mailer instance. |
|
protected Dispatcher | $events | The event dispatcher instance. |
|
protected array | $from | The global from address and name. |
|
protected Writer | $logger | The log writer instance. |
|
protected Container | $container | The IoC container instance. |
|
protected | $queue | ||
protected bool | $pretending | Indicates if the actual sending is disabled. |
|
protected array | $failedRecipients | Array of failed recipients. |
|
protected array | $parsedViews | Array of parsed views containing html and text view name. |
Methods
Create a new Mailer instance.
Set the global from address and name.
Send a new message when only a plain part.
Build the callable for a queued e-mail job.
Get the true callable for a queued e-mail message.
Add the content to a given message.
Parse the given view name or array.
Send a Swift Message instance.
Log that a message was sent.
Create a new message instance.
Tell the mailer to not really send messages.
Check if the mailer is pretending to send messages.
Get the view factory instance.
Get the Swift Mailer instance.
Get the array of failed recipients.
Set the Swift Mailer instance.
Details
void
__construct(Factory $views, Swift_Mailer $swift, Dispatcher $events = null)
Create a new Mailer instance.
void
alwaysFrom(string $address, string $name = null)
Set the global from address and name.
int
plain(string $view, array $data, mixed $callback)
Send a new message when only a plain part.
void
send(string|array $view, array $data, Closure|string $callback)
Send a new message using a view.
mixed
queue(string|array $view, array $data, Closure|string $callback, string $queue = null)
Queue a new e-mail message for sending.
mixed
queueOn(string $queue, string|array $view, array $data, Closure|string $callback)
Queue a new e-mail message for sending on the given queue.
mixed
later(int $delay, string|array $view, array $data, Closure|string $callback, string $queue = null)
Queue a new e-mail message for sending after (n) seconds.
mixed
laterOn(string $queue, int $delay, string|array $view, array $data, Closure|string $callback)
Queue a new e-mail message for sending after (n) seconds on the given queue.
protected mixed
buildQueueCallable(mixed $callback)
Build the callable for a queued e-mail job.
void
handleQueuedMessage(Job $job, array $data)
Handle a queued e-mail message job.
protected mixed
getQueuedCallable(array $data)
Get the true callable for a queued e-mail message.
protected void
addContent(Message $message, string $view, string $plain, array $data)
Add the content to a given message.
protected array
parseView(string|array $view)
Parse the given view name or array.
protected void
sendSwiftMessage(Swift_Message $message)
Send a Swift Message instance.
protected void
logMessage(Swift_Message $message)
Log that a message was sent.
protected mixed
callMessageBuilder(Closure|string $callback, Message $message)
Call the provided message builder.
protected Message
createMessage()
Create a new message instance.
protected View
getView(string $view, array $data)
Render the given view.
void
pretend(bool $value = true)
Tell the mailer to not really send messages.
bool
isPretending()
Check if the mailer is pretending to send messages.
Factory
getViewFactory()
Get the view factory instance.
Swift_Mailer
getSwiftMailer()
Get the Swift Mailer instance.
array
failures()
Get the array of failed recipients.
void
setSwiftMailer(Swift_Mailer $swift)
Set the Swift Mailer instance.
$this
setLogger(Writer $logger)
Set the log writer instance.
$this
setQueue(QueueManager $queue)
Set the queue manager instance.
void
setContainer(Container $container)
Set the IoC container instance.