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();
27 echo "HELO : {$helo} \n";
31 foreach ($ff->Core_Notify['routes'] as $server => $settings){
32 if(empty($settings['domains']) || empty($settings['username']) || empty($settings['password'])){
33 $error[] = "{$server} - Missing domains / username / password";
37 $socket_options = array (
39 'verify_peer' => false,
40 'verify_peer_name' => false
44 $smtp = new Net_SMTP($server, $settings['port'], $helo, false, 0, $socket_options);
46 // $smtp->setDebug(true);
48 echo "Connecting : {$server}:{$settings['port']} \n";
50 $res = $smtp->connect(10);
52 if (is_a($res, 'PEAR_Error')) {
53 $error[] = "{$server} - Cound not connect";
57 echo "Login As : {$settings['username']}:{$settings['password']} \n";
59 $res = $smtp->auth($settings['username'], $settings['password']);
61 if (is_a($res, 'PEAR_Error')) {
62 $error[] = "{$server} - Cound not login";
77 $ifconfig = file_get_contents("https://ifconfig.co/");
78 $dom = new DomDocument('1.0', 'utf-8');
79 $dom->loadHTML($ifconfig);
81 $xpath = new DOMXPath($dom);
83 $element = $xpath->query("//code[@class='ip']");
85 if(!$element->length){
89 $ip = $element->item(0)->nodeValue;
95 $helo = substr(array_pop(explode(' ', $e)), 0, -2);