Foros del Web » Programando para Internet » PHP »

Error al enviar el correo

Estas en el tema de Error al enviar el correo en el foro de PHP en Foros del Web. Buenas noches mi problema es el siguiente. Tengo un formulario que se muestra en la siguiente liga: http://autopartesacr.com.mx/detallesCar.php?idauto=68 La función es en teoría simple se ...
  #1 (permalink)  
Antiguo 11/11/2013, 22:31
 
Fecha de Ingreso: enero-2012
Mensajes: 24
Antigüedad: 12 años, 3 meses
Puntos: 0
Exclamación Error al enviar el correo

Buenas noches mi problema es el siguiente.

Tengo un formulario que se muestra en la siguiente liga:

http://autopartesacr.com.mx/detallesCar.php?idauto=68

La función es en teoría simple se trata de enviar una url a un amigo para que pueda visualizar un vehículo, al momento de dar enviar el archivo php de nombre sendmail_auto.php me arroja un error, que no lo puede enviar:

Oops!

Hubo un error al enviar el mensaje.
Tienes un nuevo mensaje!
email_f: [email protected]
undefined: ENVIAR MENSAJE


Mensaje: Este vehículo te puede interesar:
http://autopartesacr.com.mx/detallesCar.php?idproducto=68


A continuacion pongo el código de sendmail_auto.php:

<?php


// Change this with your blog name and email address
$the_blogname = 'Autopartes ACR';
$the_myemail = $_REQUEST['email_f'];


if(isset($_POST['email'])){
error_reporting(0);
$errorC = false;

$the_email = $_POST['email'];
$the_name = 'ACR Autopartes';
$the_message = $_POST['message'];

$the_phone = 'ACR Autopartes';
$the_fax = 'ACR Autopartes';
$the_company = 'ACR Autopartes';
$the_website = 'ACR Autopartes';

# want to add aditional fields? just add them to the form in template_contact.php,
# you dont have to edit this file

//added fields that are not set explicit like the once above are combined and added before the actual message
$already_used = array('email','email_f','yourname','message','phon e','fax','company','website','myblogname','tempcod e','temp_url','ajax');
$attach = '';

foreach ($_POST as $key => $field)
{
if(!in_array($key,$already_used))
{
$attach.= $key.": ".$field."<br /> \n";
}
}
$attach.= "<br /> \n";

if(!checkmymail($the_email))
{
$errorC = true;
$the_emailclass = "error";
}else{
$the_emailclass = "valid";
}

if($the_message == "")
{
$errorC = true;
$the_messageclass = "error";
}else{
$the_messageclass = "valid";
}

if($errorC == false)
{
$to = $the_myemail;
$subject = "Nuevo Mensaje - Contacto " . $the_blogname;
$header = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$header .= 'From:'. $the_email . " \r\n";

$message1 = nl2br($the_message);

if(!empty($the_name)) $the_name = "Nombre: $the_name <br/>";
if(!empty($the_company)) $the_company = "Empresa: $the_company <br/>";
if(!empty($the_phone)) $the_phone = "Telefono: $the_phone <br/>";
if(!empty($the_fax)) $the_fax = "Fax: $the_fax <br/>";
if(!empty($the_website)) $the_website = "Website: $the_website <br/>";

$message = "
Tienes un nuevo mensaje ! <br/>
Mensaje: $message1 <br />";



if(@mail($to,$subject,$message,$header)) $send = true; else $send = false;

if(isset($_POST['ajax'])){

if ($send)
echo '<h3>Tu mensaje se ha enviado!</h3><div class="confirm">
<p class="textconfirm">Gracias por tu preferencia.<br/> AUTOPARTES ACR</p>
</div>';
else
echo '<h3>Oops!</h3><div class="confirm">
<p class="texterror">Hubo un error al enviar el mensaje.</p>
</div>'.$message;

}
}

}
  #2 (permalink)  
Antiguo 11/11/2013, 22:33
 
Fecha de Ingreso: enero-2012
Mensajes: 24
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: Error al enviar el correo

El código del formulario:

<form action="sendmail_auto.php" method="POST" class="details_form" id="offer_send_friend">
<div class="form_col_1">
<div class="row">
<label class="label_title">Tu email:</label>
<input type="text" name="email" id="email" class="inputField required" value="">
</div>
<div class="row">
<label class="label_title">Destinatario:</label>
<input type="text" name="email_f" id="email_f" class="inputField required" value="">
</div>
</div>

<div class="form_col_2 col_thin">
<div class="row">
<label class="label_title">Mensaje:</label>
<textarea rows="4" cols="5" name="message" id="message" class="textareaField required">Este veh&iacute;culo te puede interesar:
http://autopartesacr.com.mx/detallesCar.php?idproducto=<?php echo"$idauto" ?></textarea>
</div>
<div class="row rowSubmit">
<a href="#" class="link_reset" onclick="document.getElementById('offer_send_frien d').reset();return false">Resetear Info.</a>
<input type="submit" value="ENVIAR MENSAJE" id="send_f" class="btn_send">
</div>
</div>

<div class="form_col_3">
<div class="row">
<label class="label_title">Share on:</label>
<span class='st_sharethis_vcount' displayText='ShareThis'></span>
<span class='st_facebook_vcount' displayText='Facebook'></span>
<span class='st_twitter_vcount' displayText='Tweet'></span>

</div>
</div>


</form>

Etiquetas: php+ajax+formularios
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:34.