3 require_once 'Pman.php';
4 require_once "Mail.php";
5 require_once 'Mail/smtpmx.php';
7 class Pman_Core_NotifySmtpCheck extends Pman
17 $ff = HTML_FlexyFramework::get();
20 empty($ff->Core_Notify) ||
21 empty($ff->Core_Notify['routes'])
26 $helo = $this->getHelo();
28 echo "HELO : {$helo} \n";
32 foreach ($ff->Core_Notify['routes'] as $server => $settings){
33 if(empty($settings['domains']) || empty($settings['username']) || empty($settings['password'])){
34 $error[] = "{$server} - Missing domains / username / password";
38 $socket_options = array (
40 'verify_peer' => false,
41 'verify_peer_name' => false
45 $smtp = new Net_SMTP($server, $settings['port'], $helo, false, 0, $socket_options);
47 // $smtp->setDebug(true);
49 echo "Connecting : {$server}:{$settings['port']} \n";
51 $res = $smtp->connect(10);
53 if (is_a($res, 'PEAR_Error')) {
54 $error[] = "{$server} - Cound not connect";
58 echo "Login As : {$settings['username']}:{$settings['password']} \n";
60 $res = $smtp->auth($settings['username'], $settings['password']);
62 if (is_a($res, 'PEAR_Error')) {
63 $error[] = "{$server} - Cound not login";
78 $ifconfig = file_get_contents("https://ifconfig.co/");
79 $dom = new DomDocument('1.0', 'utf-8');
80 $dom->loadHTML($ifconfig);
82 $xpath = new DOMXPath($dom);
84 $element = $xpath->query("//code[@class='ip']");
86 if(!$element->length){
90 $ip = $element->item(0)->nodeValue;
96 $helo = substr(array_pop(explode(' ', $e)), 0, -2);