1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Azine\EmailBundle\Services; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* This is an example how to override the AzineWebViewSerive. |
7
|
|
|
* |
8
|
|
|
* @codeCoverageIgnoreStart |
9
|
|
|
* |
10
|
|
|
* @author dominik |
11
|
|
|
*/ |
12
|
|
|
class ExampleWebViewService extends AzineWebViewService |
13
|
|
|
{ |
14
|
|
|
public function getTemplatesForWebPreView() |
15
|
|
|
{ |
16
|
|
|
$templates = array(); |
17
|
|
|
|
18
|
|
|
// add your own templates here like this: |
19
|
|
|
|
20
|
|
|
$templates = $this->addTemplate($templates, 'Some other mail', ExampleTemplateProvider::SOME_OTHER_MAIL_TEMPLATE); |
21
|
|
|
$templates = $this->addTemplate($templates, 'VIP Infos', ExampleTemplateProvider::VIP_INFO_MAIL_TEMPLATE); |
22
|
|
|
|
23
|
|
|
return $templates; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function getTestMailAccounts() |
27
|
|
|
{ |
28
|
|
|
$emails = array(); |
29
|
|
|
|
30
|
|
|
// add your own test-email-accounts here like this: |
31
|
|
|
$emails = $this->addTestMailAccount($emails, 'Testmail-account for MS Outlook', '[email protected]'); |
32
|
|
|
$emails = $this->addTestMailAccount($emails, 'Testmail-account for Gmail', 'your.email.address@gmail'); |
33
|
|
|
|
34
|
|
|
return $emails; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function getDummyVarsFor($template, $locale, $variables = array()) |
38
|
|
|
{ |
39
|
|
|
// override this method to provide dummy-variables |
40
|
|
|
// to view rendered templates for emails that you didn't send yet |
41
|
|
|
// or to send an email with dummy-variables to your test-account(s) |
42
|
|
|
// |
43
|
|
|
// do something like this: |
44
|
|
|
// |
45
|
|
|
if (ExampleTemplateProvider::VIP_INFO_MAIL_TEMPLATE == $template) { |
46
|
|
|
$vipVars = array(); |
47
|
|
|
$aUser = null; |
48
|
|
|
$vipVars['vipInfos'] = $someService->getVipInfosFor($aUser); |
|
|
|
|
49
|
|
|
$vipVars['userTitle'] = 'You majesty'; |
50
|
|
|
$variables['contentItems'][] = array(ExampleTemplateProvider::VIP_INFO_MAIL_TEMPLATE => $vipVars); |
51
|
|
|
} elseif (ExampleTemplateProvider::SOME_OTHER_MAIL_TEMPLATE == $template) { |
52
|
|
|
$otherMailVars = array(); |
53
|
|
|
$otherMailVars['date'] = new \DateTime('long ago'); |
54
|
|
|
$variables['contentItems'][] = array(ExampleTemplateProvider::SOME_OTHER_MAIL_TEMPLATE => $otherMailVars); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
$variables['sendMailAccountName'] = 'some name'; |
58
|
|
|
$variables['sendMailAccountAddress'] = '[email protected]'; |
59
|
|
|
$variables['subject'] = 'some dummy subject'; |
60
|
|
|
|
61
|
|
|
return $variables; |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|