- foreach ($settings['domains'] as $dom){
-// $mailer = Mail::factory('smtp', array(
-// 'host' => $dom ,
-// 'localhost' => $server,
-// 'timeout' => 15,
-// 'auth' => true,
-// 'username' => $settings['username'],
-// 'password' => $settings['password']
-// ));
-//
-// print_R($mailer);exit;
-
- $params = array(
- 'netdns' => false
- );
-
- $smtpmx = new Mail_smtpmx($params);
-
- $smtpmx->_smtp = new Net_SMTP($server, $smtpmx->port, $smtpmx->mailname);
-
-// print_R($smtpmx->_smtp);exit;
-
- $res = $smtpmx->_smtp->connect($smtpmx->timeout);
-
- if (is_a($res, 'PEAR_Error')) {
- print_R('error?????');exit;
- }
+ $socket_options = array (
+ 'ssl' => array(
+ 'verify_peer' => false,
+ 'verify_peer_name' => false
+ )
+ );
+ if (empty($settings['port'])) {
+ $settings['port'] = 25;
+ }
+ $smtp = new Net_SMTP($server, $settings['port'], $helo, false, 0, $socket_options);
+
+// $smtp->setDebug(true);