1 | <?php |
||
20 | class Smtp implements SenderInterface |
||
21 | { |
||
22 | /** |
||
23 | * The connection timeout. |
||
24 | * |
||
25 | * @var int |
||
26 | */ |
||
27 | protected $timeout = -1; |
||
28 | |||
29 | /** |
||
30 | * Use a secure connection. |
||
31 | * |
||
32 | * @var bool |
||
33 | */ |
||
34 | protected $secure = false; |
||
35 | |||
36 | /** |
||
37 | * SMTP server. |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $server = ''; |
||
42 | |||
43 | /** |
||
44 | * Connection port. |
||
45 | * |
||
46 | * @var int |
||
47 | */ |
||
48 | protected $port = 25; |
||
49 | |||
50 | /** |
||
51 | * Username for authorization. |
||
52 | * |
||
53 | * @var string |
||
54 | */ |
||
55 | protected $auth_username = ''; |
||
56 | |||
57 | /** |
||
58 | * Password for authorization. |
||
59 | * |
||
60 | * @var string |
||
61 | */ |
||
62 | protected $auth_password = ''; |
||
63 | |||
64 | /** |
||
65 | * @param string $server |
||
66 | * @param int $port |
||
67 | * @param string $username |
||
68 | * @param string $password |
||
69 | */ |
||
70 | public function __construct($server, $port = 25, $username = '', $password = '') |
||
77 | |||
78 | /** |
||
79 | * Send E-mail message. |
||
80 | * |
||
81 | * @param Message $message |
||
82 | * |
||
83 | * @return bool |
||
84 | */ |
||
85 | public function send(Message $message) |
||
127 | |||
128 | /** |
||
129 | * Set timeout connecting to the server. |
||
130 | * |
||
131 | * @param int $timeout |
||
132 | * |
||
133 | * @return self |
||
134 | */ |
||
135 | public function setTimeOut($timeout) |
||
143 | |||
144 | /** |
||
145 | * Start secure connection. |
||
146 | * |
||
147 | * @param bool $secure |
||
148 | * |
||
149 | * @return self |
||
150 | */ |
||
151 | public function setSecure($secure = true) |
||
157 | } |
||
158 |