Hola buenas.
Necesitaria un formulario de contacto que funcione en condiciones, tengo varios uno me funciona ok alojado en una web gratuita pero en otra de pago no va pufffff .
Salud2.
por que no va?
si funciona funciona, si no te funciona en otro hosting, el problema casi seguro no es el hosting sino tu
Cita de: engel lex en 19 Mayo 2017, 20:51 PM
por que no va?
si funciona funciona, si no te funciona en otro hosting, el problema casi seguro no es el hosting sino tu
Pues por eso posteo en el foro para conseguir un formulario de contacto no conflictivo.
Salud2.
Cita de: eugeniocol en 19 Mayo 2017, 21:25 PM
Pues por eso posteo en el foro para conseguir un formulario de contacto no conflictivo.
Salud2.
Bueno pon el código que tienes para que podamos ayudarte por que, que un formulario funcione en un hosting y en otro hosting no funcione es muy raro será la configuración de la base de datos o no se. Pega el código para que podamos ayudarte
Cita de: WIитX en 20 Mayo 2017, 03:55 AM
Bueno pon el código que tienes para que podamos ayudarte por que, que un formulario funcione en un hosting y en otro hosting no funcione es muy raro será la configuración de la base de datos o no se. Pega el código para que podamos ayudarte
ste es html :
<!doctype html5>
<html lang="es">
<head>
<title>email</title>
<meta name="viewport" content="width=device-width; user-scalable=no; initial-scale=1; maximun-scale=1; minimun-scale=1">
</head>
<body>
<style>
body {
background-color: lightcyan;
}
input:required:invalid, textarea:required:invalid {
border: 2px solid red;
border-radius:5px;
background: #E983CC;
}
input:required:valid, textarea:required:valid {
border: 2px solid green;
border-radius:5px;
background: white;
}
input:invalid {
border: 2px solid red;
border-radius:5px;
background: #E983CC;
}
input:valid {
border: 2px solid green;
border-radius:5px;
background: white;
}
.boton {
color: green;
background-color:lightblue;
}
</style>
<form name="contactform" method="post" action="email.php">
<table width="360px">
<tr>
<td></td>
<td>
<h1>Contacto</h1>
</td>
</tr>
<tr>
<td valign="top">
<label for="first_name">Nombre *</label>
</td>
<td valign="top">
<input title="Se necesita un nombre" type="text" name="first_name" maxlength="50" size="22" pattern="[a-zA-ZàáâäãåąčćęèéêëėįìíîïłńòóôöõøùúûüųūÿýżźñçčšžÀÁÂÄÃÅĄĆČĖĘÈÉÊËÌÍÎÏĮŁŃÒÓÔÖÕØÙÚÛÜŲŪŸÝŻŹÑßÇŒÆČŠŽ∂ð ,.'-]{3,30}" required>
</td>
</tr>
<tr>
<td valign="top"">
<label for="last_name">Apellido *</label>
</td>
<td valign="top">
<input title="Se necesita un nombre" type="text" name="last_name" maxlength="50" size="22" pattern="[^0-9·]{3,30}" required>
</td>
</tr>
<tr>
<td valign="top">
<label for="email">Email *</label>
</td>
<td valign="top">
<input title="Se necesita un correo valido" type="email" name="email" maxlength="80" size="22" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" required>
</td>
</tr>
<tr>
<td valign="top">
<label for="telephone ">Telefono</label>
</td>
<td valign="top">
<input title="Se necesita un numero telefonico"type="text" name="telephone" maxlength="30" size="22" pattern="[0-9]{8,}">
</td>
</tr>
<tr>
<td valign="top">
<label for="comments">Mensaje *</label>
</td>
<td valign="top">
<textarea name="comments" minlength="8" maxlength="1000" cols="36" rows="6" required></textarea>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center">
<input class="boton" type="submit" value="Enviar"> <a href="https://xxxxxxxxxxxxxx.es"><b>Inicio Web</b></a>
</td>
</tr>
</table>
</form>
</body>
</htlm>
y el sen_from_email.php
<?php
/* Parametros para varios servidores
HOTMAIL
$smtp->SMTPAuth = true;
$smtp->SMTPSecure = "tls";
$smtp->Host = "smtp.live.com";
$smtp->Username = "miCuenta@outlook.com";
$smtp->Password = "miPassword";
$smtp->Port = 25;
GMAIL
$smtp->SMTPAuth = true;
$smtp->SMTPSecure = "tls";
$smtp->Host = "smtp.gmail.com";
$smtp->Username = "miCuenta@gmail.com";
$smtp->Password = "miPassword";
$smtp->Port = 587;
YAHOO
$smtp->SMTPAuth = true;
$smtp->SMTPSecure = "ssl";
$smtp->Host = "smtp.mail.yahoo.com";
$smtp->Username = "miCuenta@yahoo.com";
$smtp->Password = "miPassword";
$smtp->Port = 465;
*/
require 'PHPMailer-master/PHPMailerAutoload.php';
$mail = new PHPMailer;
// $mail->SMTPDebug = 3; // Enable verbose debug output
$enviar2 = '';
// Configurar el servidor, cambiar solo email y paasword si es de yahoo.
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.mail.yahoo.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'xxxxxxxxxx@yahoo.es'; // SMTP username
$mail->Password = 'xxxxxxxxx'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
// Parametros para configurar
$correo = 'xxxxxxxxxxxxx@yahoo.es';
$mailer = 'Mi web';
$enviar1 = 'xxxxxxxxxxxxx@yahoo.es'; // Obligatorio
$enviar2 = 'xxxxxxxx@gmail.com'; //Opcional, si no se usa dejar vacio entre ''
$asunto = 'xxxxxxxxxxxx';
//**********************************************//
// Parametros de mail.html, no tocar nada //
//**********************************************//
$first_name = $_POST['first_name']; // required
$last_name = $_POST['last_name']; // required
$email_from = $_POST['email']; // required
$telephone = $_POST['telephone']; // not required
$comments = $_POST['comments']; // required
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "First Name: ".clean_string($first_name)."<br>\n";
$email_message .= "Last Name: ".clean_string($last_name)."<br>\n";
$email_message .= "Email: ".clean_string($email_from)."<br>\n";
$email_message .= "Telephone: ".clean_string($telephone)."<br>\n";
$email_message .= "Comments: ".clean_string($comments)."<br>\n";
// envio de correo
$mail->Sender=$correo;
$mail->setFrom($correo, $mailer);
$mail->addAddress($enviar1, 'Eugenio'); // Add a recipient
if (!empty($enviar2)) {
$mail->addAddress($enviar2, ''); // Name is optional
}
// $mail->addReplyTo('info@example.com', 'Information');
// $mail->addCC('cc@example.com');
// $mail->addBCC('bcc@example.com');
// $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
// $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $asunto;
$mail->Body = $email_message;
$mail->AltBody = $email_message;
if(!$mail->send()) {
echo 'Mensaje sin enviar.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
phpAlert("Mensaje sin enviar!\\n\\nPHP has got an Alert Box");
} else {
echo 'El mensaje fue enviado';
phpAlert("Mensaje enviado!\\n\\n");
header ('Refresh: 5; URL=email.html');
}
function phpAlert($msg) {
echo '<script type="text/javascript">alert("' . $msg . '")</script>';
}
Y después esta la carpeta PHPMailer-Master pero de esta yo no he tocado nada
Un Saludo.