Hola,
Trato de conectarme al servidor smtp de gmail, pero no lo logro. Este es mi codigo:   
Código PHP:
Ver original- <?php 
- class ForoSmtp{ 
-                         'autentificar'=>false, 
-                         'host'=>'', 
-                         'port'=>25, 
-                         'ssl'=>false, 
-                                       'user'=>'', 
-                                       'clave'=>'' 
-                                       ), 
-                         'conn'=>false, 
-                         'mensaje'=>array('html'=>false,'msg'=>''), 
-                         'titulo'=>'', 
-                         'server'=>'' 
-                         ); 
-     public $Foro; 
-      
-     public function __construct($Foro){ 
-     //  $this->Foro=$Foro; 
-     } 
-     public function setHost($host){ 
-         $this->data['host']=$host; 
-     } 
-     public function setPort($port){ 
-         $this->data['port']=$port; 
-     } 
-     public function setAuth($user=false,$clave=false){ 
-         if(!$user||!$clave){ 
-         //  $this->Foro->setError('Error, no se definio el usuario o clave.'); 
-         } 
-         $this->data['autentificar']=true; 
-         $this->data['user']['user']=$user; 
-         $this->data['user']['clave']=$clave; 
-     } 
-     public function isHtml($html=false){ 
-         $this->data['mensaje']['html']=$html; 
-     } 
-     public function isSsl($ssl){ 
-         $this->data['ssl']=$ssl; 
-     } 
-     public function setMsg($msg){ 
-         $this->data['mensaje']['msg']=$msg; 
-     } 
-     public function setDestino($email,$nombre=''){ 
-         $this->data['destinos'][]=array($email,$nombre); 
-     } 
-     public function setTitle($titulo){ 
-         $this->data['titulo']=$titulo; 
-     } 
-      
-     ####################################################### 
-      
-     public function SmtpConect(){ 
-         if(!$this->Conectar()) 
-             return false; 
-         // hasta aqui se conecto todo bien, pero desde esta linea anda mal :S 
-         if(!$this->SendHelo($this->data['server'])) 
-             return false; 
-         return true; 
- /*      if($this->data['autentificar']){ 
-             fputs($this->data['conn'],"AUTH LOGIN \r\n"); 
-             if(intval(substr($this->getRequest(),0,3))!=334) 
-                 return false; 
-              
-             fputs($this->data['conn'],base64_encode($this->data['user']['user'])."\r\n"); 
-             if(intval(substr($this->getRequest(),0,3))!=334) 
-                 return false; 
-                  
-             fputs($this->data['conn'], base64_encode($this->data['user']['clave'])."\r\n"); 
-             if(intval(substr($this->getRequest(),0,3))!=235) 
-                 return false; 
-              
-         }*/ 
-         return true; 
-     } 
-     private function Conectar(){ 
-         $host=($this->data['ssl']?'ssl://':'').$this->data['host']; 
-         $port=intval($this->data['port']); 
-          
-         if(!$con) 
-             return false; 
-         $this->data['conn']=$con; 
-         return true; 
-     } 
-     private function SendHelo($server){ 
-         if($this->data['conn']===false) 
-             return false; 
-              
-         if(empty($server)&&isset($_SERVER['SERVER_NAME'])) 
-             $server=$_SERVER['SERVER_NAME']; 
-         else 
-             $server="localhost.localdomain"; 
-              
-         if(!$this->resivirConexion('EHLO',$server)){ 
-             if(!$this->resivirConexion('HELO',$server)) 
-                 return false; 
-         } 
-         return true; 
-     } 
-     private function resivirConexion($helo,$server){ 
-         if($this->data['conn']===false) 
-             return false; 
-          
-         fputs($this->data['conn'],$helo." ".$server."\r\n"); 
-          
-         $buffer=$this->getRequest(); 
-         if($code!=250) 
-             return false; 
-         return true; 
-     } 
- // igual al de phpmailer.. creo que esto es el problema :s 
-     private function getRequest() { 
-         if($this->data['conn']===false) 
-             return false;    
-         $data=""; 
-         while($str=@fgets($this->data['conn'],515)){ 
-             $data.=$str; 
-                 break; 
-         } 
-         return $data; 
-     } 
- } 
- $ForoSmtp=new ForoSmtp(''); 
- $ForoSmtp->setHost('smtp.gmail.com'); 
- $ForoSmtp->setPort(465); 
- if(!$ForoSmtp->SmtpConect()) 
-     exit('No se pudo conectar con el servidor.'); 
- echo "Conectado"; 
- ?> 
Gracias
Salu2 
