3 require_once 'Pman.php';
4 require_once "Mail.php";
5 require_once 'Mail/smtpmx.php';
7 class Pman_Core_NotifySmtpCheck extends Pman
16 $ff = HTML_FlexyFramework::get();
19 empty($ff->Core_Notify) ||
20 empty($ff->Core_Notify['routes'])
25 $helo = $this->getHelo();
29 foreach ($ff->Core_Notify['routes'] as $server => $settings){
30 if(empty($settings['domains']) || empty($settings['username']) || empty($settings['password'])){
31 $error[] = "{$server} - Missing domains / username / password";
35 $socket_options = array (
37 'verify_peer' => false,
38 'verify_peer_name' => false
42 $smtp = new Net_SMTP($server, $settings['port'], $helo, false, 0, $socket_options);
44 // $smtp->setDebug(true);
46 $res = $smtp->connect(10);
48 if (is_a($res, 'PEAR_Error')) {
49 $error[] = "{$server} - Cound not connect";
53 $res = $smtp->auth($settings['username'], $settings['password']);
55 if (is_a($res, 'PEAR_Error')) {
56 $error[] = "{$server} - Cound not login";
71 $ifconfig = file_get_contents("https://ifconfig.co/");
72 $dom = new DomDocument('1.0', 'utf-8');
73 $dom->loadHTML($ifconfig);
75 $xpath = new DOMXPath($dom);
77 $element = $xpath->query("//code[@class='ip']");
79 if(!$element->length){
83 $ip = $element->item(0)->nodeValue;
89 $helo = substr(array_pop(explode(' ', $e)), 0, -2);