|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the login-cidadao project or it's bundles. |
|
4
|
|
|
* |
|
5
|
|
|
* (c) Guilherme Donato <guilhermednt on github> |
|
6
|
|
|
* |
|
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
8
|
|
|
* file that was distributed with this source code. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace LoginCidadao\CoreBundle\Mailer; |
|
12
|
|
|
|
|
13
|
|
|
use FOS\UserBundle\Mailer\TwigSwiftMailer as BaseMailer; |
|
14
|
|
|
use FOS\UserBundle\Model\UserInterface; |
|
15
|
|
|
use LoginCidadao\CoreBundle\Model\PersonInterface; |
|
16
|
|
|
|
|
17
|
|
|
class TwigSwiftMailer extends BaseMailer |
|
18
|
|
|
{ |
|
19
|
|
|
protected $mailerSenderMail; |
|
20
|
|
|
|
|
21
|
|
|
public function setMailerSenderMail($var) |
|
22
|
|
|
{ |
|
23
|
|
|
$this->mailerSenderMail = $var; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function sendEmailChangedMessage(UserInterface $user, $oldEmail) |
|
27
|
|
|
{ |
|
28
|
|
|
$template = $this->parameters['template']['email_changed']; |
|
29
|
|
|
$fromEmail = $this->parameters['from_email']['email_changed']; |
|
30
|
|
|
$fromName = $this->parameters['from_email']['email_sender_name']; |
|
31
|
|
|
$from = [$fromEmail => $fromName]; |
|
32
|
|
|
|
|
33
|
|
|
$context = [ |
|
34
|
|
|
'user' => $user, |
|
35
|
|
|
'oldEmail' => $oldEmail, |
|
36
|
|
|
]; |
|
37
|
|
|
|
|
38
|
|
|
$this->sendMessage($template, $context, $from, $oldEmail); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function sendAccountBlockedMessage(PersonInterface $person) |
|
42
|
|
|
{ |
|
43
|
|
|
$template = $this->parameters['template']['account_blocked']; |
|
44
|
|
|
$fromEmail = $this->parameters['from_email']['account_blocked']; |
|
45
|
|
|
$fromName = $this->parameters['from_email']['email_sender_name']; |
|
46
|
|
|
$from = [$fromEmail => $fromName]; |
|
47
|
|
|
|
|
48
|
|
|
$context = ['email' => $person->getEmail()]; |
|
49
|
|
|
$this->sendMessage($template, $context, $from, $person->getEmail()); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function sendAccountAutoBlockedMessage(PersonInterface $person) |
|
53
|
|
|
{ |
|
54
|
|
|
$template = $this->parameters['template']['account_auto_blocked']; |
|
55
|
|
|
$fromEmail = $this->parameters['from_email']['account_auto_blocked']; |
|
56
|
|
|
$fromName = $this->parameters['from_email']['email_sender_name']; |
|
57
|
|
|
$from = [$fromEmail => $fromName]; |
|
58
|
|
|
|
|
59
|
|
|
$context = ['email' => $person->getEmail()]; |
|
60
|
|
|
$this->sendMessage($template, $context, $from, $person->getEmail()); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|