Yo he usado un programa llamado
PHP-Form Wizard 1.2.5.
Te pongo el script que generó, funciona perfectamente, está dirigido al correo
[email protected] y envía una confirmación al visitante. Ya verás vos si lo editás.
Código PHP:
<?php
# ----------------------------------------------------
# -----
# ----- This script was generated by PHP-Form Wizard 1.2.5 on 02/07/2010 at 05:18:18 p.m.
# -----
# ----- http://www.tools4php.com
# -----
# ----------------------------------------------------
// Receiving variables
@$pfw_ip= $_SERVER['REMOTE_ADDR'];
@$Company = addslashes($_POST['Company']);
@$Name = addslashes($_POST['Name']);
@$Address = addslashes($_POST['Address']);
@$Phone = addslashes($_POST['Phone']);
@$Email = addslashes($_POST['Email']);
@$comments = addslashes($_POST['comments']);
// Validation
if (strlen($Name) == 0 )
{
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid name</font></p>");
}
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $Address))
{
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid address</font></p>");
}
if (strlen($Address) == 0 )
{
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid address</font></p>");
}
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $Email))
{
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>");
}
if (strlen($Email) == 0 )
{
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>");
}
if (strlen($comments) == 0 )
{
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid comments</font></p>");
}
//Sending Email to form owner
$pfw_header = "From: $Email\n"
. "Reply-To: $Email\n";
$pfw_subject = "Mensaje recibido";
$pfw_email_to = "[email protected]";
$pfw_message = "Visitor's IP: $pfw_ip\n"
. "Company: $Company\n"
. "Name: $Name\n"
. "Address: $Address\n"
. "Phone: $Phone\n"
. "Email: $Email\n"
. "comments: $comments\n";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
//Sending auto respond Email to visitor
$pfw_header = "From: [email protected]\n"
. "Reply-To: [email protected]\n";
$pfw_subject = "Mensaje recibido";
$pfw_email_to = "$Email";
$pfw_message = "$Name hemos recibido su mensaje. Nos comuncaremos pronto con usted.";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
echo("<p align='center'><font face='Arial' size='5' color='#008000'>Mensaje enviado correctamente.</font></p>");
?>