Mark V
1: <?php
2: namespace MOC\V\Component\Mail\Component\Bridge\Repository;
3:
4: use Eden\Mail\Pop3;
5: use MOC\V\Component\Mail\Component\Bridge\Bridge;
6: use MOC\V\Component\Mail\Component\IBridgeInterface;
7: use MOC\V\Component\Mail\Exception\MailException;
8: use MOC\V\Core\AutoLoader\AutoLoader;
9:
10: /**
11: * Class EdenPhpPop3
12: *
13: * @package MOC\V\Component\Mail\Component\Bridge\Repository
14: */
15: class EdenPhpPop3 extends Bridge implements IBridgeInterface
16: {
17:
18: /** @var null|Pop3 $Instance */
19: private $Instance = null;
20:
21: /**
22: *
23: */
24: public function __construct()
25: {
26:
27: AutoLoader::getNamespaceAutoLoader('Eden\Mail',
28: __DIR__.'/../../../Vendor/EdenPhpMail/1.0.3-Master',
29: 'Eden\Mail'
30: );
31: AutoLoader::getNamespaceAutoLoader('Eden\Core',
32: __DIR__.'/../../../Vendor/EdenPhpMail/1.0.3-Master/vendor/eden/core/Eden/Core',
33: 'Eden\Core'
34: );
35: AutoLoader::getNamespaceAutoLoader('Eden\System',
36: __DIR__.'/../../../Vendor/EdenPhpMail/1.0.3-Master/vendor/eden/system/Eden/System',
37: 'Eden\System'
38: );
39: AutoLoader::getNamespaceAutoLoader('Eden\Type',
40: __DIR__.'/../../../Vendor/EdenPhpMail/1.0.3-Master/vendor/eden/type/Eden/Type',
41: 'Eden\Type'
42: );
43: }
44:
45: /**
46: * @param string $Host
47: * @param string $Username
48: * @param string $Password
49: * @param null|int $Port
50: * @param bool $useSSL
51: * @param bool $useTLS
52: *
53: * @return EdenPhpPop3
54: * @throws MailException
55: */
56: public function connectServer($Host, $Username, $Password, $Port = null, $useSSL = false, $useTLS = false)
57: {
58:
59: try {
60: $this->Instance = new Pop3($Host, $Username, $Password, $Port, $useSSL, $useTLS);
61: $this->Instance->connect();
62: } catch (\Exception $Exception) {
63: throw new MailException($Exception->getMessage(), $Exception->getCode(), $Exception);
64: }
65: return $this;
66: }
67:
68: /**
69: * @return EdenPhpPop3
70: * @throws MailException
71: */
72: public function disconnectServer()
73: {
74:
75: try {
76: $this->Instance->disconnect();
77: } catch (\Exception $Exception) {
78: throw new MailException($Exception->getMessage(), $Exception->getCode(), $Exception);
79: }
80: return $this;
81: }
82: }
83: