Skip to content

Instantly share code, notes, and snippets.

@jozefcipa
Last active November 9, 2017 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jozefcipa/68e7aeb5cd649625d3897200591c09b7 to your computer and use it in GitHub Desktop.
Save jozefcipa/68e7aeb5cd649625d3897200591c09b7 to your computer and use it in GitHub Desktop.
Sending exceptions in Laravel to mail
<?php
// app/Mail/ExceptionOccured.php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class ExceptionOccured extends Mailable
{
use Queueable, SerializesModels;
protected $exceptionHtml;
/**
* Create a new message instance.
*
* @param $exceptionHtml
* @internal param Exception $e
*/
public function __construct($exceptionHtml)
{
$this->exceptionHtml = $exceptionHtml;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->subject('Exception occured !')
->view('mail.exception')
->with('exceptionHtml', $this->exceptionHtml);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment