Ver Mensaje Individual
  #17 (permalink)  
Antiguo 01/02/2010, 16:40
albertrc
 
Fecha de Ingreso: febrero-2009
Mensajes: 443
Antigüedad: 15 años, 3 meses
Puntos: 1
Respuesta: problemas para mandar emails con php

es para saber si esta abiero o cerrado
getsebool -a | grep sendmail
httpd_can_sendmail --> off

linux permite abrir el cortafuegos permanentemente
setsebool -P httpd_can_sendmail 1

getsebool -a | sendmail
httpd_can_sendmail --> on


reniciar servidor
service httpd restart









el problema de phpmailer es que si tiene el correo y el mensaje envía el correo
aunque tu quieras que otros campos tengan que ser obligatorios

he intentado validar con php pero phpmailer pasa de mis validaciones sino también te lo hubiera colgador


aqui hay el fichero class.phpmailer.php que tienes que incluir en el ejemplo
http://sourceforge.net/projects/phpm...0for%20php5_6/

ejemplo para gmail
http://phpmailer.worxware.com/index....=exampleagmail


Código PHP:
<?php
include("class.phpmailer.php"); 
     

//include("class.smtp.php"); 

$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch 

$mail->IsSMTP(); // telling the class to use SMTP 

try { 
  
$mail->Host       "localhost"// SMTP server 
  
$mail->SMTPDebug  2;                     // enables SMTP debug information (for testing) 
  
$mail->SMTPAuth   true;                  // enable SMTP authentication 
  
$mail->SMTPSecure "ssl";                 // sets the prefix to the servier 
  
$mail->Host       "smtp.gmail.com";      // sets GMAIL as the SMTP server 
  
$mail->Port       465;                   // set the SMTP port for the GMAIL server 
  
$mail->Username   "[email protected]";  // GMAIL username 
  
$mail->Password   "****************";            // GMAIL password 




  //$mail->AddReplyTo('[email protected]', 'First Last'); 
 
$mail->AddAddress(strtolower($_POST['correo']),strtolower($_POST['nombre']) ); 
$mail->SetFrom('[email protected]''negocio'); 
//$mail->AddReplyTo('[email protected]', 'First Last');//remitent 
$mail->Subject=("negocio ".strtolower($_POST['asunto'])); 
$mail->MsgHTML(strtolower($_POST['mensaje'])); 







$mail->Send(); 



  echo 
"<span class='correcto'><h2>Mensaje enviadao correctamente</h2></span>\n"
} catch (
phpmailerException $e) { 
echo 
$e->errorMessage(); //Pretty error messages from PHPMailer 
} catch (Exception $e) { 
echo 
$e->getMessage(); //Boring error messages from anything else! 

?>
</body>
</html>


Última edición por albertrc; 01/02/2010 a las 16:55