-
-
Notifications
You must be signed in to change notification settings - Fork 829
/
Mailer.php
46 lines (39 loc) · 1.32 KB
/
Mailer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Mail;
use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\View\Factory;
use Illuminate\Mail\Mailer as SymfonyMailer;
use Symfony\Component\Mailer\Transport\TransportInterface;
class Mailer extends SymfonyMailer
{
public function __construct(
string $name,
Factory $views,
TransportInterface $transport,
Dispatcher $events = null,
protected SettingsRepositoryInterface $settings
) {
parent::__construct($name, $views, $transport, $events);
}
public function send($view, array $data = [], $callback = null)
{
$emailType = $this->settings->get('mail_format');
switch ($emailType) {
case 'html':
unset($view['text']);
break;
case 'plain':
unset($view['html']);
break;
// case 'multipart' is the default, where Flarum will send both HTML and text versions of emails, so that the recipient's email client can choose which one to display.
}
parent::send($view, $data, $callback);
}
}