Jump to content


Photo

No me funciona la funcion mail de php...


  • Please log in to reply
3 replies to this topic

#1 Nery92

Nery92

    Member

  • Miembros
  • PipPip
  • 13 posts

Posted 13 January 2012 - 12:56 PM

Ayuda!!! no me funciona la funcion (valga la redundancia) mail de php, ya lo subi a un hosting, en el localhost me daba un error de mail, pero cuando lo subi al hosting ya no me dio el error pero no me llego nada al correo...
aqui les dejo el codigo que utilize el procesa.php...

<?php
require_once("conexion.php");
$sql="insert into contactos
values (
null,'".$_POST["nom"]."','".$_POST["tel"]."','".$_POST["correo"]."','".$_POST["mensaje"]."',now(),now()
)";
$res=mysql_query($sql,$con);
//********************************
$remitente="Mi_Pagina<info@midominio.com>";
$asunto="Mensaje desde mi sitio web";
$cuerpo="<html>
<head>
<body>
<table align='center' width='400'>

<tr>
<td align='right' width='200'>
Nombre:
</td>
<td align='left' width='200'>
".$_POST["nom"]."
</td>
</tr>

<tr>
<td align='right' width='200'>
Telefono:
</td>
<td align='left' width='200'>
".$_POST["tel"]."
</td>
</tr>

<tr>
<td align='right' width='200'>
E-mail:
</td>
<td align='left' width='200'>
".$_POST["correo"]."
</td>
</tr>

<tr>
<td align='right' width='200'>
Mensaje:
</td>
<td align='left' width='200'>
".$_POST["mensaje"]."
</td>
</tr>

</table>
</body>
</head>
</html>";

$sheader="From:".$remitente."\nReply-To:".$remitente."\n";
$sheader=$sheader."X-Mailer:PHP/".phpversion()."\n";
$sheader=$sheader."Mime-Version: 1.0\n";
$sheader=$sheader."Content-Type: text/html";

mail("nery_king92@hotmail.com",$asunto,$cuerpo,$sheader);

echo"<script type='text/javascript'>
alert('Su mensaje ha sido enviado');
window.location='index.php';
</script>";

?>

  • 0

#2 enecumene

enecumene

    Webmaster

  • Administrador
  • 7419 posts
  • LocationRepública Dominicana

Posted 16 January 2012 - 11:14 AM

Verifica que tu hosting tenga servicio de mail incluido.

Saludos.
  • 0

#3 luisgutierrezb

luisgutierrezb

    Advanced Member

  • Miembros
  • PipPipPip
  • 92 posts
  • LocationMéxico

Posted 16 January 2012 - 12:03 PM

Te recomiendo la libreria php mailer, muy buena y a lo mejor te puede servir...
  • 0

#4 chrismark182

chrismark182

    Advanced Member

  • Miembros
  • PipPipPip
  • 65 posts

Posted 16 January 2012 - 01:35 PM

Ayuda!!! no me funciona la funcion (valga la redundancia) mail de php, ya lo subi a un hosting, en el localhost me daba un error de mail, pero cuando lo subi al hosting ya no me dio el error pero no me llego nada al correo...
aqui les dejo el codigo que utilize el procesa.php...

<?php
require_once("conexion.php");
$sql="insert into contactos
values (
null,'".$_POST["nom"]."','".$_POST["tel"]."','".$_POST["correo"]."','".$_POST["mensaje"]."',now(),now()
)";
$res=mysql_query($sql,$con);
//********************************
$remitente="Mi_Pagina<info@midominio.com>";
$asunto="Mensaje desde mi sitio web";
$cuerpo="<html>
<head>
<body>
<table align='center' width='400'>

<tr>
<td align='right' width='200'>
Nombre:
</td>
<td align='left' width='200'>
".$_POST["nom"]."
</td>
</tr>

<tr>
<td align='right' width='200'>
Telefono:
</td>
<td align='left' width='200'>
".$_POST["tel"]."
</td>
</tr>

<tr>
<td align='right' width='200'>
E-mail:
</td>
<td align='left' width='200'>
".$_POST["correo"]."
</td>
</tr>

<tr>
<td align='right' width='200'>
Mensaje:
</td>
<td align='left' width='200'>
".$_POST["mensaje"]."
</td>
</tr>

</table>
</body>
</head>
</html>";

$sheader="From:".$remitente."\nReply-To:".$remitente."\n";
$sheader=$sheader."X-Mailer:PHP/".phpversion()."\n";
$sheader=$sheader."Mime-Version: 1.0\n";
$sheader=$sheader."Content-Type: text/html";

mail("nery_king92@hotmail.com",$asunto,$cuerpo,$sheader);

echo"<script type='text/javascript'>
alert('Su mensaje ha sido enviado');
window.location='index.php';
</script>";

?>



localmente si te da error por ke tu servidor tiene ke tener el servicio de correo (cosa que no tienen los servidores localmente) y si has probado hosting chekeate ke tenga servicio de correo. informame!
  • 0




IP.Board spam blocked by CleanTalk.