3 require_once 'Pman.php';
4 require_once "Mail.php";
5 require_once 'Mail/smtpmx.php';
7 class Pman_Core_NotifySmtpCheck extends Pman
11 $ff = HTML_FlexyFramework::get();
14 empty($ff->Core_Notify) ||
15 empty($ff->Core_Notify['routes'])
20 $helo = $this->getHelo();
24 foreach ($ff->Core_Notify['routes'] as $server => $settings){
25 if(empty($settings['domains']) || empty($settings['username']) || empty($settings['password'])){
26 $error[] = "{$server} - Missing domains / username / password";
30 $socket_options = array (
32 'verify_peer' => false,
33 'verify_peer_name' => false
37 $smtp = new Net_SMTP($server, $settings['port'], $helo, false, 0, $socket_options);
39 $smtp->setDebug(true);
41 $res = $smtp->connect(10);
43 if (is_a($res, 'PEAR_Error')) {
44 $error[] = "{$server} - Cound not connect";
48 $res = $smtp->auth($settings['username'], $settings['password']);
50 if (is_a($res, 'PEAR_Error')) {
51 $error[] = "{$server} - Cound not login";
61 $ifconfig = file_get_contents("https://ifconfig.co/");
62 $dom = new DomDocument('1.0', 'utf-8');
63 $dom->loadHTML($ifconfig);
65 $xpath = new DOMXPath($dom);
67 $element = $xpath->query("//code[@class='ip']");
69 if(!$element->length){
73 $ip = $element->item(0)->nodeValue;
79 $helo = substr(array_pop(explode(' ', $e)), 0, -2);