Página 1 de 1

enviar formulario a email

Publicado: 18 Nov 2011, 22:50
por zido45
URL: http://pruebaprimeraweb.nixiweb.com/contact.html
Versión phpBB: php
MODs Instalados: Ninguno
Plantilla(s) usada(s): Prosilver
Servidor:
Actualización desde otra versión: No
Conversión desde otro sistema de foros: No



Hola buenas no sabia muy bien donde poner esta duda en cuestion, disculpen las molestias, les cuento.

tengo una web un formulario html mediante el cual quiero enviar esos datos que rellenes al correo/email pero no soy capaz
tengo los siguientes codigo.

Código: Seleccionar todo

	    <!-- Contact Form -->
			<form action='send_email1.php' method='post' id='contact_form'>
					<h3>Formulario de contacto.</h3>
				<div class="hr dotted clearfix">&nbsp;</div>
				<ul>						
					<li class="clearfix"> 
						<label for="name">Nombre/Name</label>
						<input type='text' name='name' id='name' />
						<div class="clear"></div>
						<p id='name_error' class='error'>Insert a Name</p>
					</li> 
					<li class="clearfix"> 
						<label for="email">Email</label>
						<input type='text' name='email' id='email' />
						<div class="clear"></div>
						<p id='email_error' class='error'>Enter a valid email address</p>
					</li> 
					<li class="clearfix"> 
						<label for="subject">Título/Subject</label>
						<input type='text' name='subject' id='subject' />
						<div class="clear"></div>
						<p id='subject_error' class='error'>Enter a message subject</p>
					</li> 
					<li class="clearfix"> 
						<label for="message"> Mensaje/Message</label>
						<textarea name='message' id='message' rows="30" cols="30"></textarea>
						<div class="clear"></div>
						<p id='message_error' class='error'>Enter a message</p>
					</li> 
					<li class="clearfix"> 
						
					<p id='mail_success' class='success'>Thank you. I'll get back to you as soon as possible.</p>
					<p id='mail_fail' class='error'>Sorry, an error has occured. Please try again later.</p>
					<div id="button">
					<input type='submit' id='send_message' class="button" value='Enviar' />
					</div>
					</li> 
				</ul> 
		  </form>  
		</div>
y en ese archivo send_email.php tengo esto.

Código: Seleccionar todo

<?php
    //we need to get our variables first
    
    include 'config.php';  // aqui tengo mi direccion de correo
    $name     =   $_POST['name'];  
    $email    =   $_POST['email'];
    $subject  =   $_POST['subject'];
    $message  =   $_POST['message'];
    
    /*the $header variable is for the additional headers in the mail function,
     we are asigning 2 values, first one is FROM and the second one is REPLY-TO.
     That way when we want to reply the email gmail(or yahoo or hotmail...) will know 
     who are we replying to. */
    $headers  = "From: $email\r\n";
    $headers .= "Reply-To:$email\r\n
    
    if(mail($email_to, $subject, $message, $headers)){
        echo 'sent'; // we are sending this text to the ajax request telling it that the mail is sent.. 
 
    }else{
        echo 'failed';// ... or this one to tell it that it wasn't sent    
    }
?>

Re: enviar formulario a email

Publicado: 22 Nov 2011, 12:04
por Megabyte
tu url no funciona. :)