3 require_once 'Pman.php';
6 class Pman_Core_NotifySmtpCheck extends Pman
10 require_once "Mail.php";
11 require_once 'Mail/smtpmx.php';
14 function get($v, $opts=array())
22 $ff = HTML_FlexyFramework::get();
25 empty($ff->Core_Notify) ||
26 empty($ff->Core_Notify['routes'])
31 $helo = $this->getHelo();
33 echo "HELO : {$helo} \n";
37 foreach ($ff->Core_Notify['routes'] as $server => $settings){
38 if(empty($settings['domains']) || empty($settings['username']) || empty($settings['password'])){
39 $error[] = "{$server} - Missing domains / username / password";
43 $socket_options = array (
45 'verify_peer' => false,
46 'verify_peer_name' => false
49 if (empty($settings['port'])) {
50 $settings['port'] = 25;
52 $smtp = new Net_SMTP($server, $settings['port'], $helo, false, 0, $socket_options);
54 // $smtp->setDebug(true);
56 echo "Connecting : {$server}:{$settings['port']} \n";
58 $res = $smtp->connect(10);
60 if (is_a($res, 'PEAR_Error')) {
61 $error[] = "{$server} - Cound not connect";
65 echo "Login As : {$settings['username']}:{$settings['password']} \n";
67 $res = $smtp->auth($settings['username'], $settings['password']);
69 if (is_a($res, 'PEAR_Error')) {
70 $error[] = "{$server} - Cound not login";
85 $ifconfig = file_get_contents("https://ifconfig.co/");
86 $dom = new DomDocument('1.0', 'utf-8');
87 @$dom->loadHTML($ifconfig);
89 $xpath = new DOMXPath($dom);
91 $element = $xpath->query("//code[@class='ip']");
93 if(!$element->length){
97 $ip = $element->item(0)->nodeValue;
103 $helo = substr(array_pop(explode(' ', $e)), 0, -2);