Ver Mensaje Individual
  #9 (permalink)  
Antiguo 24/06/2013, 08:19
Avatar de koolj
koolj
 
Fecha de Ingreso: octubre-2011
Mensajes: 27
Antigüedad: 12 años, 6 meses
Puntos: 1
Respuesta: No funciona código

Tal ves es algo con el SMTP
Yo probé este código y funciona. Espero te sirva
Código:
<?php
    if ($_POST) {
        $name = $_POST['nombre'];
        $para = "[email protected]";
        $asunto = $_POST['asunto'];
        $mensaje = $_POST['mensaje'];
        $email = $_POST['email'];
        $cabeceras  = 'MIME-Version: 1.0' . "\r\n";
        $cabeceras .= 'Content-type: text/html; charset=utf-8' . "\r\n";
        $cabeceras .= 'From: <'.$email.'>' . "\r\n";
        if (mail($para, $asunto, $mensaje, $cabeceras)) {
                $result = "Email enviado";
        } else {
            $result = "Upps Ocurio un error";
        }
    }
    else{
        $result = "";
    }
?>
<html>
    <head>
        <title>Contacto</title>
        <link rel='stylesheet' href='estilos.css'>
        <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'></script>
        <script src='funciones.js'></script>
    </head>
    <body>
        <form class='contacto' method='POST' action=''>
            <div><label>Tu Nombre:</label><input type='text' class='nombre' name='nombre'></div>
            <div><label>Tu Email:</label><input type='text' class='email' name='email'></div>
            <div><label>Asunto:</label><input type='text' class='asunto' name='asunto'></div>
            <div><label>Mensaje:</label><textarea rows='6' class='mensaje' name='mensaje'></textarea></div>
            <div><input type='submit' value='Envia Mensaje' class='boton' name='boton'></div>
             <?php echo $result; ?>
        </form>
    </body>
</html>