Ver Mensaje Individual
  #6 (permalink)  
Antiguo 03/04/2012, 01:02
yoviejito15
 
Fecha de Ingreso: diciembre-2010
Mensajes: 22
Antigüedad: 13 años, 5 meses
Puntos: 0
Respuesta: problema al enviar correo en php

Buenos dias.

Continue probando con sendmail, sin embargo no tuve exito, en algunas ocasiones no me mandaba nada y me aparecia que se habia enviado, y en otras ocasiones me marca el siguiente error:

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\rapidinmensajeria\sendmail.php on line 79



Las paginas que utilizo son dos la primera solo es el formulario y las validadiones y la segunda es el codigo que envia el mail

Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy for Linux (vers 1 September 2005), see www.w3.org" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Instituto Tecnol&oacute;gico de Pabell&oacute;n de Arteaga</title>
<meta http-equiv="Content-Language" content="es" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="robot" content="index, follow" />
<link rel="stylesheet" type="text/css" />
<script src="../../js/AC_RunActiveContent.js" type="text/javascript">
</script>
<script src="../../js/script.js" type="text/javascript">
</script>
<script language="javascript" type="text/javascript">
//<![CDATA[
function imprimir(pag){
        window.print();
}

function PopUps(theURL,winName,features) { //v2.0
        window.open(theURL,winName,features);
}

function limpiaTexto()
{
        if (document.buscador.q.value != "")
                document.buscador.q.value = "";
}
//]]>
</script>
<style type="text/css">
/*<![CDATA[*/
<!--
.style2 {
        font-size: 36px
}
.style3 {font-size: 15px}
.style4 {
        font-size: 20px
}
-->
/*]]>*/
</style>
<link rel="shortcut icon" href="../../images/mini_logo.ico" type="image/x-icon" />
<style type="text/css">
/*<![CDATA[*/
<!--
.style1 {color: #FFFFFF}
a:hover {
        color: #666666;
}
.style6 {       font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 14px;
}
.style5 {color: #666666}
-->
/*]]>*/
</style>

<style type="text/css">
/*<![CDATA[*/
 h3.c7 {text-align: right}
 td.c6 {background-repeat:no-repeat; background-position:bottom}
 div.c5 {text-align: left}
 div.c4 {text-align: justify}
 div.c3 {text-align: center}
 p.c2 {text-align: left}
 h2.c1 {text-align: left}
/*]]>*/
</style>
</head>
<body>
Tu opinión es importante, si has notado que alguno de nuestros enlaces está roto, algo no funciona, hay contenido no apropiado o si tienes algún comentario, dalo a conocer por este medio y con gusto te responderemos lo más pronto posible. <br />
<table width="63%" border="0" bgcolor="#FFFFFF">
  <tr>
    <td height="16" bgcolor="#FFFFFF"><div class="c4">
      <table width="100%" border="0">
        <tr>
          <th scope="col"> <form id="form1" name="form1" method="post" action="sendmail.php">
            <div class="c3">
              <p align="center">
                <input type="hidden" name="ip" value="128.30.52.49" />
                <input type="hidden" name="httpref" value="" />
                <input type="hidden" name="httpagent" value="W3C_Validator/1.606" />
                Nombre*:<br />
                <input type="text" name="visitor" size="35" />
                <br />
                <br />
                Correo electr&oacute;nico*:<br />
                <input type="text" name="visitormail" size="35" />
                <br />
                <br />
                Comentarios*:<br />
                <textarea name="notes" rows="4" cols="40">
</textarea>
              </p>
              <p align="center"><br />
                <input type="button" value="Enviar" onclick="validar(this.form)"/>
                <br/>
              </p>
            </div>
          </form>
          </th>
        </tr>
  </table>
      <span class="style3 style1">....................................................................................................................................................................................</span></div></td>
  </tr>
</table>
<script type="text/javascript">
//<![CDATA[

function validar(form){

if(form.visitor.value==""||form.visitormail.value ==""|| form.notes.value==""){
alert('Sus comentarios son muy valiosos para nosotros.\nPor favor complete los campos solicitados.');
return;

}else{
var re  = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
if (!re.test(form.visitormail.value)) {
    alert ("Dirección de email inválida");
    return false;
}

form.submit()
}
}
//]]>
</script>
</body>
</html>




Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<title>Sendemail Script</title>
<style type="text/css">
<!--
.Estilo2 {font-size: 36px}
.style1 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 16px;
	text-align: center;
}
.style2 {
	font-size: 24px;
	font-family: Verdana, Arial, Helvetica, sans-serif;
}
a:link {
	color: #990000;
}
a:hover {
	color: #990000;
}
a:visited {
	color: #990000;
}
-->
</style>
</head>
<body>

<div align="center">
  <!-- Reminder: Add the link for the 'next page' (at the bottom) --> 
  <!-- Reminder: Change 'YourEmail' to Your real email --> 
  
  <?php

//$httpref = $_POST['httpref']; 
//$httpagent = $_POST['httpagent']; 
$visitor = $_POST['visitor']; 
$visitormail = $_POST['visitormail']; 
$notes = $_POST['notes'];
  
if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) 
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n"; 
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}

if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! "); 
}

$todayis = date("l, F j, Y, g:i a") ;

$notes = stripcslashes($notes); 

$message = "$todayis [EST]
Recibido 
Nombre: $visitor
Mail: $visitormail\n
Mensaje: $notes



";

$from = "From: $visitormail\r\n";


mail("[email protected]", $from, $message);

?>
</div>
<div align="center"></div>
 <div align="justify"></div>
 <p align="center"><span class="style2">Sus comentarios se han enviado exitosamente</span></p>
 
 <script language=javascript>
function closer() {
var ventana = window.self;
ventana.opener = window.self;
ventana.close();

} 
</script>
 

 
 <td width="574" height="77" class="Rotulo_heliconia style1"><form id="form1" name="form1" method="post" action="">
 </form>
   <br />
  <br />
  <br />
  <br />
 <a href="contact.php"></a></td>
</body>
</html>




Tambien probe con el phpMailer y me arroja el siguiente error:

Código:
<?php
	require("class.phpmailer.php");
    $mail             = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPAuth   = true;
    //$mail->SMTPSecure = "ssl";
    //$mail->Host       = "mail.rapidinmensajeria.com.mx";
	$mail->Host       = "smtp.gmail.com";
    $mail->Port       = 587;
    $mail->Username   = '[email protected]';
    $mail->Password   = "mipassword";
    //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    //====== DE QUIEN ES ========
    $mail->From       = "[email protected]";
    $mail->FromName   = "Nestor";
    //$mail->AddAttachment("images/foto.jpg", "foto_regalo.jpg"); //Archivo adjunto
    //====== PARA QUIEN =========
    $mail->Subject    = "Test Mail";
   // $mail->AddAddress("[email protected]","Para ti juan");
    $mail->AddAddress("[email protected]","Para ti alberto");

	if($mail->Send()) {
	echo "Mensaje enviado correctamente";
	} else {
	echo "Error al enviar mensaje: " . $mail->ErrorInfo;
	}

?>
no se que mas hacer, agradezco mucho su apoyo, ojala alguien me pueda apoyar.

Saludos.