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;
59 'verify_peer' => false,
60 'verify_peer_name' => false,
61 'allow_self_signed' => true));
63 $smtp = new Net_SMTP($server, 25, $dom, false, 0, $options);
65 $smtp->setDebug(true);
68 // print_R($smtpmx->_smtp);exit;
70 $res = $smtp->connect($smtpmx->timeout);
72 if (is_a($res, 'PEAR_Error')) {
73 print_R('error?????');exit;
76 $r = $smtp->auth($settings['username'], $settings['password']);
79 // $smtpmx->_smtp->disconnect();
80 print_r("resutlt : {$res} \n");
83 // $mx = $smtpmx->_getMx($dom);
85 // foreach ($mx as $mserver => $mpriority) {
87 // $smtpmx->_smtp = new Net_SMTP($mserver, $smtpmx->port, $smtpmx->mailname);
89 //// print_R($smtpmx);exit;
90 // $res = $smtpmx->_smtp->connect($smtpmx->timeout);
92 // $smtpmx->_smtp->disconnect();
94 // print_R($res);exit;