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'])
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 foreach ($settings['domains'] as $dom){
40 $socket_options = array (
42 'verify_peer' => false,
43 'verify_peer_name' => false,
44 'allow_self_signed' => true
48 $smtp = new Net_SMTP($server, $settings['port'], '058177247238.ctinets.com', false, 0, $socket_options);
50 $smtp->setDebug(true);
52 $res = $smtp->connect(10);
54 if (is_a($res, 'PEAR_Error')) {
55 die("Cound not connect to {$server}");
58 $res = $smtp->auth($settings['username'], $settings['password']);
60 if (is_a($res, 'PEAR_Error')) {
64 print_R("SUCCESS? {$res} \n");
67 // $mx = $smtpmx->_getMx($dom);
69 // foreach ($mx as $mserver => $mpriority) {
71 // $smtpmx->_smtp = new Net_SMTP($mserver, $smtpmx->port, $smtpmx->mailname);
73 //// print_R($smtpmx);exit;
74 // $res = $smtpmx->_smtp->connect($smtpmx->timeout);
76 // $smtpmx->_smtp->disconnect();
78 // print_R($res);exit;