3 require_once 'Pman.php';
4 require_once "Mail.php";
5 require_once 'Mail/smtpmx.php';
7 class Pman_Core_NotifySmtpCheck extends Pman
9 static $cli_desc = "Check SMTP";
11 static $cli_opts = array();
21 $ff = HTML_FlexyFramework::get();
24 empty($ff->Core_Notify) ||
25 empty($ff->Core_Notify['routes'])
30 $ifconfig = file_get_contents("https://ifconfig.co/");
31 $dom = new DomDocument('1.0', 'utf-8');
32 $dom->loadHTML($ifconfig);
34 $xpath = new DOMXPath($dom);
36 $element = $xpath->query("//code[@class='ip']");
38 if(!$element->length){
42 $ip = $element->item(0)->nodeValue;
48 $helo = array_pop(explode(' ', $e));
54 foreach ($ff->Core_Notify['routes'] as $server => $settings){
55 if(empty($settings['domains']) || empty($settings['username']) || empty($settings['password'])){
56 $error[] = "{$server} missing domains / username / password";
60 foreach ($settings['domains'] as $dom){
62 $socket_options = array (
64 'verify_peer' => false,
65 'verify_peer_name' => false,
66 'allow_self_signed' => true
70 $smtp = new Net_SMTP($server, $settings['port'], '058177247238.ctinets.com', false, 0, $socket_options);
72 $smtp->setDebug(true);
74 $res = $smtp->connect(10);
76 if (is_a($res, 'PEAR_Error')) {
77 die("Cound not connect to {$server}");
80 $res = $smtp->auth($settings['username'], $settings['password']);
82 if (is_a($res, 'PEAR_Error')) {
86 print_R("SUCCESS? {$res} \n");