Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/01/2018, 04:10
Avatar de manyblue
manyblue
 
Fecha de Ingreso: marzo-2008
Mensajes: 329
Antigüedad: 16 años
Puntos: 10
Problema phpmailer y gmail

La verdad es que no se que esta pasando, me funcionaba perfecto y ahora no.
Tengo xampp con php 5.6, windows 7.
Al enviar el email (y poniendo $mail->SMTPDebug = 1;) me salta estos errores:
Código:
Warning:  stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in C:\xampp\htdocs\tienda2017VegaNorte\includes\class.smtp.php on line 248
SMTP -> ERROR: RSET failed:  KGA����6b��6�@��Đo�Jr_י��&Ӳ�fxl��>��"��|Dm�S�H�V�s��)�m)뭝��mNP����E������br���f�!L�)S�6�c�����|��]��d|���nMz��m��gw�y��!|�kYh������_���g@v�•�>��ET=���{� �M&@���G��c��g���FsI�87#m\�2�N@�^�����X�R� ��k��د�<�%��GpM�9$��{�&[���~&��!lL�nk� *7�t    ;��da�� �V�Y���@苻 
SMTP -> NOTICE: EOF caught while checking if connectedThe following From address failed:  [email protected] : Called Mail() without being  connected Error: The following From address failed: [email protected] : Called Mail() without being  connected
La línea en cuestión class.smtp.php on line 248:
Código PHP:
  public function StartTLS() {
    
$this->error null# to avoid confusion

    
if(!$this->connected()) {
      
$this->error = array("error" => "Called StartTLS() without being connected");
      return 
false;
    }

    
fputs($this->smtp_conn,"STARTTLS" $this->CRLF);

    
$rply $this->get_lines();
    
$code substr($rply,0,3);

    if(
$this->do_debug >= 2) {
      
$this->edebug("SMTP -> FROM SERVER:" $rply $this->CRLF '<br />');
    }

    if(
$code != 220) {
      
$this->error =
         array(
"error"     => "STARTTLS not accepted from server",
               
"smtp_code" => $code,
               
"smtp_msg"  => substr($rply,4));
      if(
$this->do_debug >= 1) {
        
$this->edebug("SMTP -> ERROR: " $this->error["error"] . ": " $rply $this->CRLF '<br />');
      }
      return 
false;
    }

    
// Begin encrypted connection
    
if(!stream_socket_enable_crypto($this->smtp_conntrueSTREAM_CRYPTO_METHOD_TLS_CLIENT)) {   //Línea 248
      
return false;
    }

    return 
true;
  } 
Código PHP:
<?php
function EnvioCorreoHTML($destinatario$contenido$asunto$concopia=0)
{

    
$mensaje mail_cabecera();
    
$mensaje.= $contenido;
    
$mensaje.=mail_pie();

    
// Para enviar correo HTML, la cabecera Content-type debe definirse
    
    
$cabeceras  'MIME-Version: 1.0' "\n";
    
$cabeceras .= 'Content-type: text/html; charset=utf-8' "\n";
    
    
// Cabeceras adicionales
    
$cabeceras .= 'From: '._email.'\n';
    
    
//$cabeceras .= 'Bcc: [email protected]' . "\n";
    
    // Enviarlo
    //mail($destinatario, $asunto, $mensaje, $cabeceras);
    //echo $mensaje;
    
include("includes/class.phpmailer.php");
include(
"includes/class.smtp.php");


$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug 1;

$mail->SMTPAuth true;
$mail->SMTPSecure _strSeguridadSMTP;
    

$mail->Host _strServidorCorreo;
$mail->Port _intPuertoCorreo;
$mail->Username _strEmailEnvios;
$mail->Password _strPassEMailEnvios;

$mail->From _strEmailEnvios;
$mail->FromName _T121;
$mail->Subject $asunto;
$mail->AltBody "Mensaje con notificacion";
$mail->MsgHTML(utf8_decode($mensaje));
//$mail->MsgHTML($mensaje);
    
    //$mail->MsgHTML($mensaje);
    //$mail->MsgHTML(iconv("UTF-8", "CP1252", $data));
    
$mail->AddAddress($destinatario);
    if (
$concopia==1$mail->AddBCC(_emailprincipal"Copia");
$mail->IsHTML(true);

if(!
$mail->Send()) {
  echo 
"Error: " $mail->ErrorInfo;
} else {
//  echo "Mensaje enviado a ".$destinatario;
}
    
}
?>
En los datos que le paso está el smtp:
smtp.gmail.com
587
tls
[email protected]
mypassword
Todas las variables de sesión me van bien para introducir en el formulario los datos de la compra.
La verdad es que no se que está pasando, antes funcionaba.
Muchas gracias de antemano.

Última edición por manyblue; 27/01/2018 a las 04:28