1 | <?php |
||
30 | class POP3 |
||
31 | { |
||
32 | /** |
||
33 | * The POP3 PHPMailer Version number. |
||
34 | * @var string |
||
35 | * @access public |
||
36 | */ |
||
37 | public $Version = '5.2.26'; |
||
38 | |||
39 | /** |
||
40 | * Default POP3 port number. |
||
41 | * @var int |
||
42 | * @access public |
||
43 | */ |
||
44 | public $POP3_PORT = 110; |
||
45 | |||
46 | /** |
||
47 | * Default timeout in seconds. |
||
48 | * @var int |
||
49 | * @access public |
||
50 | */ |
||
51 | public $POP3_TIMEOUT = 30; |
||
52 | |||
53 | /** |
||
54 | * POP3 Carriage Return + Line Feed. |
||
55 | * @var string |
||
56 | * @access public |
||
57 | * @deprecated Use the constant instead |
||
58 | */ |
||
59 | public $CRLF = "\r\n"; |
||
60 | |||
61 | /** |
||
62 | * Debug display level. |
||
63 | * Options: 0 = no, 1+ = yes |
||
64 | * @var int |
||
65 | * @access public |
||
66 | */ |
||
67 | public $do_debug = 0; |
||
68 | |||
69 | /** |
||
70 | * POP3 mail server hostname. |
||
71 | * @var string |
||
72 | * @access public |
||
73 | */ |
||
74 | public $host; |
||
75 | |||
76 | /** |
||
77 | * POP3 port number. |
||
78 | * @var int |
||
79 | * @access public |
||
80 | */ |
||
81 | public $port; |
||
82 | |||
83 | /** |
||
84 | * POP3 Timeout Value in seconds. |
||
85 | * @var int |
||
86 | * @access public |
||
87 | */ |
||
88 | public $tval; |
||
89 | |||
90 | /** |
||
91 | * POP3 username |
||
92 | * @var string |
||
93 | * @access public |
||
94 | */ |
||
95 | public $username; |
||
96 | |||
97 | /** |
||
98 | * POP3 password. |
||
99 | * @var string |
||
100 | * @access public |
||
101 | */ |
||
102 | public $password; |
||
103 | |||
104 | /** |
||
105 | * Resource handle for the POP3 connection socket. |
||
106 | * @var resource |
||
107 | * @access protected |
||
108 | */ |
||
109 | protected $pop_conn; |
||
110 | |||
111 | /** |
||
112 | * Are we connected? |
||
113 | * @var bool |
||
114 | * @access protected |
||
115 | */ |
||
116 | protected $connected = false; |
||
117 | |||
118 | /** |
||
119 | * Error container. |
||
120 | * @var array |
||
121 | * @access protected |
||
122 | */ |
||
123 | protected $errors = []; |
||
124 | |||
125 | /** |
||
126 | * Line break constant |
||
127 | */ |
||
128 | const CRLF = "\r\n"; |
||
129 | |||
130 | /** |
||
131 | * Simple static wrapper for all-in-one POP before SMTP |
||
132 | * @param $host |
||
133 | * @param int|bool $port The port number to connect to |
||
134 | * @param int|bool $timeout The timeout value |
||
135 | * @param string $username |
||
136 | * @param string $password |
||
137 | * @param int $debug_level |
||
138 | * @return bool |
||
139 | */ |
||
140 | public static function popBeforeSmtp( |
||
152 | |||
153 | /** |
||
154 | * Authenticate with a POP3 server. |
||
155 | * A connect, login, disconnect sequence |
||
156 | * appropriate for POP-before SMTP authorisation. |
||
157 | * @access public |
||
158 | * @param string $host The hostname to connect to |
||
159 | * @param int|bool $port The port number to connect to |
||
160 | * @param int|bool $timeout The timeout value |
||
161 | * @param string $username |
||
162 | * @param string $password |
||
163 | * @param int $debug_level |
||
164 | * @return bool |
||
165 | */ |
||
166 | public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0) |
||
201 | |||
202 | /** |
||
203 | * Connect to a POP3 server. |
||
204 | * @access public |
||
205 | * @param string $host |
||
206 | * @param int $port |
||
|
|||
207 | * @param int $tval |
||
208 | * @return bool |
||
209 | */ |
||
210 | public function connect($host, $port = false, $tval = 30) |
||
261 | |||
262 | /** |
||
263 | * Log in to the POP3 server. |
||
264 | * Does not support APOP (RFC 2828, 4949). |
||
265 | * @access public |
||
266 | * @param string $username |
||
267 | * @param string $password |
||
268 | * @return bool |
||
269 | */ |
||
270 | public function login($username = '', $password = '') |
||
296 | |||
297 | /** |
||
298 | * Disconnect from the POP3 server. |
||
299 | * @access public |
||
300 | */ |
||
301 | public function disconnect() |
||
313 | |||
314 | /** |
||
315 | * Get a response from the POP3 server. |
||
316 | * $size is the maximum number of bytes to retrieve |
||
317 | * @param int $size |
||
318 | * @return string |
||
319 | * @access protected |
||
320 | */ |
||
321 | protected function getResponse($size = 128) |
||
330 | |||
331 | /** |
||
332 | * Send raw data to the POP3 server. |
||
333 | * @param string $string |
||
334 | * @return int |
||
335 | * @access protected |
||
336 | */ |
||
337 | protected function sendString($string) |
||
349 | |||
350 | /** |
||
351 | * Checks the POP3 server response. |
||
352 | * Looks for for +OK or -ERR. |
||
353 | * @param string $string |
||
354 | * @return bool |
||
355 | * @access protected |
||
356 | */ |
||
357 | protected function checkResponse($string) |
||
371 | |||
372 | /** |
||
373 | * Add an error to the internal error store. |
||
374 | * Also display debug output if it's enabled. |
||
375 | * @param $error |
||
376 | * @access protected |
||
377 | */ |
||
378 | protected function setError($error) |
||
389 | |||
390 | /** |
||
391 | * Get an array of error messages, if any. |
||
392 | * @return array |
||
393 | */ |
||
394 | public function getErrors() |
||
398 | |||
399 | /** |
||
400 | * POP3 connection error handler. |
||
401 | * @param int $errno |
||
402 | * @param string $errstr |
||
403 | * @param string $errfile |
||
404 | * @param int $errline |
||
405 | * @access protected |
||
406 | */ |
||
407 | protected function catchWarning($errno, $errstr, $errfile, $errline) |
||
417 | } |
||
418 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.