1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Mail; |
4
|
|
|
|
5
|
|
|
use Illuminate\Bus\Queueable; |
6
|
|
|
use Illuminate\Mail\Mailable; |
7
|
|
|
use Illuminate\Queue\SerializesModels; |
8
|
|
|
|
9
|
|
|
class ExceptionOccured extends Mailable |
10
|
|
|
{ |
11
|
|
|
use Queueable, SerializesModels; |
|
|
|
|
12
|
|
|
|
13
|
|
|
private $content; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Create a new message instance. |
17
|
|
|
* |
18
|
|
|
* @return void |
19
|
|
|
*/ |
20
|
|
|
public function __construct($content) |
21
|
|
|
{ |
22
|
|
|
$this->content = $content; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Build the message. |
27
|
|
|
* |
28
|
|
|
* @return $this |
29
|
|
|
*/ |
30
|
|
|
public function build() |
31
|
|
|
{ |
32
|
|
|
$emailsTo = str_getcsv(config('exceptions.emailExceptionsTo'), ','); |
33
|
|
|
$ccEmails = str_getcsv(config('exceptions.emailExceptionCCto'), ','); |
34
|
|
|
$bccEmails = str_getcsv(config('exceptions.emailExceptionBCCto'), ','); |
35
|
|
|
$fromSender = config('exceptions.emailExceptionFrom'); |
36
|
|
|
$subject = config('exceptions.emailExceptionSubject'); |
37
|
|
|
|
38
|
|
|
if ($emailsTo[0] === null) { |
39
|
|
|
$emailsTo = config('exceptions.emailExceptionsToDefault'); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
if ($ccEmails[0] === null) { |
43
|
|
|
$ccEmails = config('exceptions.emailExceptionCCtoDefault'); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
if ($bccEmails[0] === null) { |
47
|
|
|
$bccEmails = config('exceptions.emailExceptionBCCtoDefault'); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
if (! $fromSender) { |
51
|
|
|
$fromSender = config('exceptions.emailExceptionFromDefault'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
if (! $subject) { |
55
|
|
|
$subject = config('exceptions.emailExceptionSubjectDefault'); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
return $this->from($fromSender) |
59
|
|
|
->to($emailsTo) |
60
|
|
|
->cc($ccEmails) |
61
|
|
|
->bcc($bccEmails) |
62
|
|
|
->subject($subject) |
63
|
|
|
->view(config('exceptions.emailExceptionView')) |
64
|
|
|
->with('content', $this->content); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|