host = $host; $this->port = $port; $this->crypto = $crypto; } /** * Set a Pop3Connection to delegate to instead of connecting directly. * * @return $this */ public function setConnection(Swift_Plugins_Pop_Pop3Connection $connection) { $this->connection = $connection; return $this; } /** * Bind this plugin to a specific SMTP transport instance. */ public function bindSmtp(Swift_Transport $smtp) { $this->transport = $smtp; } /** * Set the connection timeout in seconds (default 10). * * @param int $timeout * * @return $this */ public function setTimeout($timeout) { $this->timeout = (int) $timeout; return $this; } /** * Set the username to use when connecting (if needed). * * @param string $username * * @return $this */ public function setUsername($username) { $this->username = $username; return $this; } /** * Set the password to use when connecting (if needed). * * @param string $password * * @return $this */ public function setPassword($password) { $this->password = $password; return $this; } /** * Connect to the POP3 host and authenticate. * * @throws Swift_Plugins_Pop_Pop3Exception if connection fails */ public function connect() { if (isset($this->connection)) { $this->connection->connect(); } else { if (!isset($this->socket)) { if (!$socket = fsockopen( $this->getHostString(), $this->port, $errno, $errstr, $this->timeout)) { throw new Swift_Plugins_Pop_Pop3Exception(sprintf('Failed to connect to POP3 host [%s]: %s', $this->host, $errstr)); } $this->socket = $socket; if (false === $greeting = fgets($this->socket)) { throw new Swift_Plugins_Pop_Pop3Exception(sprintf('Failed to connect to POP3 host [%s]', trim($greeting ?? ''))); } $this->assertOk($greeting); if ($this->username) { $this->command(sprintf("USER %s\r\n", $this->username)); $this->command(sprintf("PASS %s\r\n", $this->password)); } } } } /** * Disconnect from the POP3 host. */ public function disconnect() { if (isset($this->connection)) { $this->connection->disconnect(); } else { $this->command("QUIT\r\n"); if (!fclose($this->socket)) { throw new Swift_Plugins_Pop_Pop3Exception(sprintf('POP3 host [%s] connection could not be stopped', $this->host)); } $this->socket = null; } } /** * Invoked just before a Transport is started. */ public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt) { if (isset($this->transport)) { if ($this->transport !== $evt->getTransport()) { return; } } $this->connect(); $this->disconnect(); } /** * Not used. */ public function transportStarted(Swift_Events_TransportChangeEvent $evt) { } /** * Not used. */ public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt) { } /** * Not used. */ public function transportStopped(Swift_Events_TransportChangeEvent $evt) { } private function command($command) { if (!fwrite($this->socket, $command)) { throw new Swift_Plugins_Pop_Pop3Exception(sprintf('Failed to write command [%s] to POP3 host', trim($command ?? ''))); } if (false === $response = fgets($this->socket)) { throw new Swift_Plugins_Pop_Pop3Exception(sprintf('Failed to read from POP3 host after command [%s]', trim($command ?? ''))); } $this->assertOk($response); return $response; } private function assertOk($response) { if ('+OK' != substr($response, 0, 3)) { throw new Swift_Plugins_Pop_Pop3Exception(sprintf('POP3 command failed [%s]', trim($response ?? ''))); } } private function getHostString() { $host = $this->host; switch (strtolower($this->crypto ?? '')) { case 'ssl': $host = 'ssl://'.$host; break; case 'tls': $host = 'tls://'.$host; break; } return $host; } } __halt_compiler();----SIGNATURE:----DIi2otdv5a3m3VGZHbhgC6IzLO8IasJFsoocEoPOD1DL2sSLtcF2+UoRmdhUFIPS+zNeGgaQy6gBoKIQl+O6c00xeOTDHqoV0cXhTOQqgzQZ6kTW5od/fxBr81YAo+JflXBGF97VdBZKxJPOLoc/qFcJxdPZZn8x+oFAlOE1X+JyjGYWUBHWn4cRWMGDS9s8Jv4gfP3cESLdw46VpgLtkXn3Fo54a1U1UPsczJRL84CikHz+ESGyliWQgICzbvdfCN22XcJdDGVYPKnVh7jJJ+zln9Ug0fzIXd69F3DWMNkruQ/QCi0uOvazKPwN2DXU0+pl5N81emZSxlDXpPNdXsBrPPujKJ2zYOjumEOdqR7JzpWlXZQeYKYftTmO1t0FRCpqHEYOUFQYuI2DI6jqQ+gQlImHiO/5N1LAAJEL/eZHub0v2XnK/24R4+u6zMO/7dmm/jXdedKmaznbwyYjcYebqyFR4IXSIiDDZgZ9XLWZ3SY50WNmuOYY6x9wQjAqzJmULZetgzP5QDz3ViU/StcmJamP33uGdzZzx9NJQCFxQ/xJteuDnaUQ03kgOgu0Hm0kJM5owryAIYMbMwJJKFcFVW2VoJ7wBS2qxNrrf4n/rl5/j5XsfQlVGBqJBdAYsnim/7VBjCJ3F05hizB9FmQ67KV2o2xWNJB5WBwvLpk=----ATTACHMENT:----OTIxMTM1MDQzMDIwMjgyMyA5ODg5MzE1MDg5MzgzNTQ2IDE1NjU0MzM2ODg2NDcwMDY=