1 | <?php |
||
2 | |||
3 | /** |
||
4 | * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
||
5 | * @copyright Aimeos (aimeos.org), 2014-2018 |
||
6 | * @package MW |
||
7 | * @subpackage Mail |
||
8 | */ |
||
9 | |||
10 | |||
11 | namespace Aimeos\MW\Mail; |
||
12 | |||
13 | |||
14 | /** |
||
15 | * Zend implementation for creating and sending e-mails. |
||
16 | * |
||
17 | * @package MW |
||
18 | * @subpackage Mail |
||
19 | */ |
||
20 | class Zend2 implements \Aimeos\MW\Mail\Iface |
||
21 | { |
||
22 | private $transport; |
||
23 | |||
24 | |||
25 | /** |
||
26 | * Initializes the instance of the class. |
||
27 | * |
||
28 | * @param \Zend\Mail\Transport\TransportInterface $transport Mail transport object |
||
29 | */ |
||
30 | public function __construct( \Zend\Mail\Transport\TransportInterface $transport ) |
||
31 | { |
||
32 | $this->transport = $transport; |
||
33 | } |
||
34 | |||
35 | |||
36 | /** |
||
37 | * Creates a new e-mail message object. |
||
38 | * |
||
39 | * @param string $charset Default charset of the message |
||
40 | * @return \Aimeos\MW\Mail\Message\Iface E-mail message object |
||
41 | */ |
||
42 | public function createMessage( $charset = 'UTF-8' ) |
||
43 | { |
||
44 | return new \Aimeos\MW\Mail\Message\Zend2( new \Zend\Mail\Message(), $charset ); |
||
45 | } |
||
46 | |||
47 | |||
48 | /** |
||
49 | * Sends the e-mail message to the mail server. |
||
50 | * |
||
51 | * @param \Aimeos\MW\Mail\Message\Iface $message E-mail message object |
||
52 | */ |
||
53 | public function send( \Aimeos\MW\Mail\Message\Iface $message ) |
||
54 | { |
||
55 | $this->transport->send( $message->getObject() ); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
56 | } |
||
57 | |||
58 | |||
59 | /** |
||
60 | * Clones the internal objects. |
||
61 | */ |
||
62 | public function __clone() |
||
63 | { |
||
64 | $this->object = clone $this->object; |
||
0 ignored issues
–
show
|
|||
65 | $this->transport = clone $this->transport; |
||
66 | } |
||
67 | } |
||
68 |