Mailer
class Mailer implements Mailer, MailQueue (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
protected string | $name | The name that is configured for the mailer. |
|
protected Factory | $views | The view factory instance. |
|
protected Swift_Mailer | $swift | The Swift Mailer instance. |
|
protected Dispatcher|null | $events | The event dispatcher instance. |
|
protected array | $from | The global from address and name. |
|
protected array | $replyTo | The global reply-to address and name. |
|
protected array | $returnPath | The global return path address. |
|
protected array | $to | The global to address and name. |
|
protected Factory | $queue | The queue factory implementation. |
|
protected array | $failedRecipients | Array of failed recipients. |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a new Mailer instance.
Set the global from address and name.
Set the global reply-to address and name.
Set the global return path address.
Set the global to address and name.
Begin the process of mailing a mailable class instance.
Begin the process of mailing a mailable class instance.
Begin the process of mailing a mailable class instance.
Send a new message with only an HTML part.
Send a new message with only a raw text part.
Send a new message with only a plain part.
Render the given message as a view.
Parse the given view name or array.
Add the content to a given message.
Render the given view.
Queue a new e-mail message for sending after (n) seconds.
Queue a new e-mail message for sending after (n) seconds on the given queue.
Create a new message instance.
Send a Swift Message instance.
Determines if the message can be sent.
Force the transport to re-connect.
Get the array of failed recipients.
Get the Swift Mailer instance.
Get the view factory instance.
Set the Swift Mailer instance.
Details
static void
macro(string $name, object|callable $macro)
Register a custom macro.
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
static bool
hasMacro(string $name)
Checks if macro is registered.
static void
flushMacros()
Flush the existing macros.
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
void
__construct(string $name, Factory $views, Swift_Mailer $swift, Dispatcher $events = null)
Create a new Mailer instance.
void
alwaysFrom(string $address, string|null $name = null)
Set the global from address and name.
void
alwaysReplyTo(string $address, string|null $name = null)
Set the global reply-to address and name.
void
alwaysReturnPath(string $address)
Set the global return path address.
void
alwaysTo(string $address, string|null $name = null)
Set the global to address and name.
PendingMail
to(mixed $users)
Begin the process of mailing a mailable class instance.
PendingMail
cc(mixed $users)
Begin the process of mailing a mailable class instance.
PendingMail
bcc(mixed $users)
Begin the process of mailing a mailable class instance.
void
html(string $html, mixed $callback)
Send a new message with only an HTML part.
void
raw(string $text, mixed $callback)
Send a new message with only a raw text part.
void
plain(string $view, array $data, mixed $callback)
Send a new message with only a plain part.
string
render(string|array $view, array $data = [])
Render the given message as a view.
void
send(Mailable|string|array $view, array $data = [], Closure|string|null $callback = null)
Send a new message using a view.
protected mixed
sendMailable(Mailable $mailable)
Send the given mailable.
protected array
parseView(string|array $view)
Parse the given view name or array.
protected void
addContent(Message $message, string $view, string $plain, string $raw, array $data)
Add the content to a given message.
protected string
renderView(string $view, array $data)
Render the given view.
protected void
setGlobalToAndRemoveCcAndBcc(Message $message)
Set the global "to" address on the given message.
mixed
queue(Mailable|string|array $view, string|null $queue = null)
Queue a new e-mail message for sending.
mixed
onQueue(string $queue, Mailable $view)
Queue a new e-mail message for sending on the given queue.
mixed
queueOn(string $queue, Mailable $view)
Queue a new e-mail message for sending on the given queue.
This method didn't match rest of framework's "onQueue" phrasing. Added "onQueue".
mixed
later(DateTimeInterface|DateInterval|int $delay, Mailable|string|array $view, string|null $queue = null)
Queue a new e-mail message for sending after (n) seconds.
mixed
laterOn(string $queue, DateTimeInterface|DateInterval|int $delay, Mailable $view)
Queue a new e-mail message for sending after (n) seconds on the given queue.
protected Message
createMessage()
Create a new message instance.
protected int|null
sendSwiftMessage(Swift_Message $message)
Send a Swift Message instance.
protected bool
shouldSendMessage(Swift_Message $message, array $data = [])
Determines if the message can be sent.
protected void
dispatchSentEvent(Message $message, array $data = [])
Dispatch the message sent event.
protected void
forceReconnection()
Force the transport to re-connect.
This will prevent errors in daemon queue situations.
array
failures()
Get the array of failed recipients.
Swift_Mailer
getSwiftMailer()
Get the Swift Mailer instance.
Factory
getViewFactory()
Get the view factory instance.
void
setSwiftMailer(Swift_Mailer $swift)
Set the Swift Mailer instance.
$this
setQueue(Factory $queue)
Set the queue manager instance.