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){
39 // $mailer = Mail::factory('smtp', array(
41 // 'localhost' => $server,
44 // 'username' => $settings['username'],
45 // 'password' => $settings['password']
48 // print_R($mailer);exit;
54 // $smtpmx = new Mail_smtpmx($params);
55 // $smtpmx->debug = true;
57 $socket_options = array (
59 'verify_peer' => false,
60 'verify_peer_name' => false,
61 'allow_self_signed' => true
65 $smtp = new Net_SMTP($server, 25, '058177247238.ctinets.com', false, 0, $socket_options);
67 $smtp->setDebug(true);
70 // print_R($smtpmx->_smtp);exit;
72 $res = $smtp->connect(10);
74 if (is_a($res, 'PEAR_Error')) {
75 die("Cound not connect to {$server}");
78 $res = $smtp->auth($settings['username'], $settings['password']);
80 if (is_a($res, 'PEAR_Error')) {
84 print_R("SUCCESS? {$res} \n");
87 // $mx = $smtpmx->_getMx($dom);
89 // foreach ($mx as $mserver => $mpriority) {
91 // $smtpmx->_smtp = new Net_SMTP($mserver, $smtpmx->port, $smtpmx->mailname);
93 //// print_R($smtpmx);exit;
94 // $res = $smtpmx->_smtp->connect($smtpmx->timeout);
96 // $smtpmx->_smtp->disconnect();
98 // print_R($res);exit;