Ver Mensaje Individual
  #2 (permalink)  
Antiguo 12/03/2014, 06:56
elasesino_broly
 
Fecha de Ingreso: abril-2013
Ubicación: venezuela
Mensajes: 92
Antigüedad: 11 años, 10 meses
Puntos: 1
Respuesta: Problemas al enviar correos a Gmail con PHP

utiliza phpmailer y te evitas esos problemas un ejemplo de php mailer para google seria este:

Código PHP:
Ver original
  1. require_once 'class.phpmailer.php';
  2.  
  3. class Mail
  4.  {
  5.      private $puerto;
  6.      private $userName;
  7.      private $password;
  8.      private $host;
  9.      private $mail;
  10.    
  11.      public function __construct(){
  12.          $this->puerto = 465;
  13.          $this->UserName = "[email protected]";
  14.          $this->password = "*****";
  15.          $this->host = "ssl://smtp.gmail.com";
  16.          $this->mail = new PHPMailer ();
  17.      }
  18.      
  19.      public function SenMail($userMail,$body,$FromName = '',$Subject = '')
  20.      {    
  21.          $this->mail -> From = $userMail;
  22.          $this->mail -> FromName = $FromName;
  23.          $this->mail -> AddAddress ($userMail);
  24.          $this->mail -> Subject = $Subject;
  25.          $this->mail -> Body = $body;
  26.          $this->mail -> IsHTML (true);
  27.    
  28.          $this->mail->IsSMTP();
  29.          $this->mail->Host = $this->host;
  30.          $this->mail->Port = $this->puerto;
  31.          $this->mail->SMTPAuth = true;
  32.          $this->mail->Username = $this->UserName;
  33.          $mail->Password = $this->password;
  34.          //$this->mail->AddAttachment("images/foto.jpg", "foto.jpg");
  35.      
  36.          if(!$this->mail->Send()){
  37.             throw new Exception('Error: ' . $this->mail->ErrorInfo);
  38.             return false;
  39.        
  40.          }else
  41.             return true;
  42.      }
  43.      
  44.      public function __destruct(){
  45.         unset($this);
  46.      }
  47.  
  48.  }
__________________
"Para el logro del triunfo es necesario pasar por las sendas de los sacrificios"