Conditions | 3 |
Paths | 4 |
Total Lines | 34 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
37 | public function sendEmail($tuttoOk, $mail, $vul) |
||
38 | { |
||
39 | $soggetto = Config::get('laravel-google-structured-data-testing-tool.mailSubjectSuccess'); |
||
40 | |||
41 | if (!$tuttoOk) { |
||
42 | $soggetto = Config::get('laravel-google-structured-data-testing-tool.mailSubjetcAlarm'); |
||
43 | } |
||
44 | |||
45 | $validator = Validator::make(['email' => $mail], [ |
||
46 | 'email' => 'required|email', |
||
47 | ]); |
||
48 | if ($validator->fails()) { |
||
49 | $this->command->error('No valid email passed: ' . $mail . '. Mail will not be sent.'); |
||
50 | return; |
||
51 | } |
||
52 | $this->command->line('Send email to <info>' . $mail . '</info>'); |
||
53 | |||
54 | Mail::send( |
||
55 | Config::get('laravel-google-structured-data-testing-tool.mailViewName'), |
||
56 | ['vul' => $vul], |
||
57 | function (\Illuminate\Mail\Message $message) use ($mail, $soggetto) { |
||
58 | $message->from( |
||
59 | Config::get('laravel-google-structured-data-testing-tool.mailFrom'), |
||
60 | Config::get('laravel-google-structured-data-testing-tool.mailFromName') |
||
61 | ); |
||
62 | $message->to($mail, $mail); |
||
63 | $message->subject($soggetto); |
||
64 | } |
||
65 | ); |
||
66 | |||
67 | |||
68 | $this->command->line('email sent.'); |
||
69 | |||
70 | } |
||
71 | } |
||
72 |