本文整理汇总了PHP中Illuminate\Mail\Mailer::failures方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::failures方法的具体用法?PHP Mailer::failures怎么用?PHP Mailer::failures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Mail\Mailer
的用法示例。
在下文中一共展示了Mailer::failures方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle the command.
*
* @param ContactFormBuilder $builder
* @param MessageBag $messages
* @param Mailer $mailer
*/
public function handle(ContactFormBuilder $builder, MessageBag $messages, Mailer $mailer)
{
// Validation failed!
if ($builder->hasFormErrors()) {
return;
}
// Delegate these for now.
$view = $this->dispatch(new GetMessageView($builder));
$data = $this->dispatch(new GetMessageData($builder));
// Build the message object.
$message = function (Message $message) use($builder) {
$this->dispatch(new BuildMessage($message, $builder));
};
// Send the email.
$mailer->send($view, $data, $message);
// If there are any failures, report.
if (count($mailer->failures()) > 0) {
$messages->error($builder->getFormOption('error_message', 'anomaly.plugin.contact::error.send_message'));
} else {
// Otherwise, show success.
$messages->success($builder->getFormOption('success_message', 'anomaly.plugin.contact::success.send_message'));
}
// Clear the form!
$builder->resetForm();
}
示例2: handle
/**
* Handle the command.
*
* @param Mailer $mailer
* @param Repository $config
* @return bool
*/
public function handle(Mailer $mailer, Repository $config)
{
$path = $this->dispatch(new GetResetPasswordPath($this->user, $this->redirect));
$mailer->send('anomaly.module.users::message/reset', compact('user', 'path'), function (Message $message) use($config) {
$message->subject('Reset your password')->to($this->user->getEmail(), $this->user->getDisplayName())->from($config->get('mail.from.address', 'noreply@localhost'));
});
return empty($mailer->failures());
}
示例3: sendMail
/**
* Send a simple email
*
* For more complex emails you might write another method
*
* @throws MailException Throws an exception containing further information as message
* @return void
*/
public function sendMail()
{
try {
$this->mail->send($this->view, $this->data, function ($message) {
$message->from($this->from['address'], $this->from['name']);
$message->to($this->to['address'], $this->to['name'])->subject($this->subject);
});
if ($this->mail->failures() != array()) {
throw new MailException($this->mailErrorMessage);
}
} catch (Swift_TransportException $e) {
$this->handleTransportExceptions($e);
}
}
示例4: failures
/**
* Get the array of failed recipients.
*
* @return array
* @static
*/
public static function failures()
{
return \Illuminate\Mail\Mailer::failures();
}
示例5: failures
/**
* Get the array of failed recipients.
*
*
*/
public function failures()
{
return $this->mailer->failures();
}