1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* ZfMailer |
4
|
|
|
* |
5
|
|
|
* @author Daniel Wolkenhauer <[email protected]> |
6
|
|
|
* @copyright Copyright (c) 1997-2019 Daniel Wolkenhauer |
7
|
|
|
* @link http://dw-labs.de/zfmailer |
8
|
|
|
* @version 0.1.0 |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace ZfMailer\Service; |
12
|
|
|
|
13
|
|
|
use Zend\View\Renderer\RendererInterface; |
14
|
|
|
use ZfMailer\Options\ModuleOptions; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* ZfMailer Service |
18
|
|
|
* Abstrakte Klasse zur Initialisierung |
19
|
|
|
* |
20
|
|
|
* @package ZfMailer |
21
|
|
|
* @subpackage Service |
22
|
|
|
*/ |
23
|
|
|
abstract class AbstractMailer |
24
|
|
|
{ |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var string Fehlermeldung |
28
|
|
|
*/ |
29
|
|
|
protected $errorMessage = null; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var ModuleOptions Options |
33
|
|
|
*/ |
34
|
|
|
protected $options = null; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var \Zend\View\Renderer\RendererInterface Renderer für Layouts |
38
|
|
|
*/ |
39
|
|
|
protected $renderer = null; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var \Zend\Mail\Message E-Mailnachricht |
43
|
|
|
*/ |
44
|
|
|
protected $mailMessage = null; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var \Zend\Mail\Transport Mailer-Transport |
48
|
|
|
*/ |
49
|
|
|
protected $transport = null; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Setzt Mailer-Options |
53
|
|
|
* @param ModuleOptions $options Mailer Options |
54
|
|
|
*/ |
55
|
1 |
|
public function setOptions(ModuleOptions $options) |
56
|
|
|
{ |
57
|
1 |
|
$this->options = $options; |
58
|
1 |
|
return $this; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Gibt Mailer Options zurück |
63
|
|
|
* @return ModuleOptions Mailer Options |
64
|
|
|
*/ |
65
|
1 |
|
public function getOptions() |
66
|
|
|
{ |
67
|
1 |
|
return $this->options; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Setzt den Renderer für eine E-Mailnachricht |
72
|
|
|
* @param \Zend\View\Renderer\RendererInterface $renderer Renderer |
73
|
|
|
*/ |
74
|
1 |
|
public function setRenderer(RendererInterface $renderer) |
75
|
|
|
{ |
76
|
1 |
|
$this->renderer = $renderer; |
77
|
1 |
|
return $this; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Gibt den Renderer zurück |
82
|
|
|
* @return \Zend\View\Renderer\RendererInterface Renderer |
83
|
|
|
*/ |
84
|
1 |
|
public function getRenderer() |
85
|
|
|
{ |
86
|
1 |
|
return $this->renderer; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Setzt eine E-Mailnachricht |
91
|
|
|
* @param \Zend\Mail\Message $mailMessage Mail-Message |
92
|
|
|
*/ |
93
|
1 |
|
public function setMailMessage($mailMessage) |
94
|
|
|
{ |
95
|
1 |
|
$this->mailMessage = $mailMessage; |
96
|
1 |
|
return $this; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Gibt ein Mail-Message Objekt zurück |
101
|
|
|
* @return \Zend\Mail\Message Mail-Message |
102
|
|
|
*/ |
103
|
1 |
|
public function getMailMessage() |
104
|
|
|
{ |
105
|
1 |
|
return $this->mailMessage; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Setzt E-Mail-Transport |
110
|
|
|
* @param \Zend\Mail\Transport $transport E-Mail-Transport |
111
|
|
|
*/ |
112
|
1 |
|
public function setTransport($transport) |
113
|
|
|
{ |
114
|
1 |
|
$this->transport = $transport; |
115
|
1 |
|
return $this; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Gibt Tramsport Objekt zurück |
120
|
|
|
* @return \Zend\Mail\Transport E-Mail-Transport |
121
|
|
|
*/ |
122
|
1 |
|
public function getTransport() |
123
|
|
|
{ |
124
|
1 |
|
return $this->transport; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* Setzt eine Fehlermeldung |
129
|
|
|
* @param string $errorMessage Fehlermeldung |
130
|
|
|
*/ |
131
|
1 |
|
public function setErrorMessage($errorMessage) |
132
|
|
|
{ |
133
|
1 |
|
$this->errorMessage = $errorMessage; |
134
|
1 |
|
return $this; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Gibt eine Fehlermeldung zurück |
139
|
|
|
* @return string Fehlermeldung |
140
|
|
|
*/ |
141
|
1 |
|
public function getErrorMessage() |
142
|
|
|
{ |
143
|
1 |
|
return $this->errorMessage; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
} |
147
|
|
|
|