
27/05/2011, 07:14
|
| | Fecha de Ingreso: mayo-2011
Mensajes: 14
Antigüedad: 13 años, 9 meses Puntos: 0 | |
Respuesta: Como resolver suscripcion y mail de autorespuesta Hasta aquí he llegado con el código, utilizando parte del código anterior que usaba el sitio web:
Código:
<html>
<head>
<title>Suscripción de Newsletters - Gold Dreams</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="3;url=http://www.midominio.com/">
</head>
<body>
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "contraseña"; // GMAIL password
$mail->Timeout=30; //Timeout del envío
import_request_variables("gP", "rvar_");
$error = 0;
if (empty($rvar_Email)) { $error = 1; }
if (!strstr($rvar_Email,"@")) { $error = 1; }
if (!strstr($rvar_Email,".")) { $error = 1; }
if ($error == 0) {
$mailbody .= "Enviado por: ".getenv("REMOTE_ADDR")."\n";
$mailbody .= "Data: ".date("F j, Y, g:i a")."\n";
$mailbody .= str_repeat("-", 80)."\n";
$mailbody .= "E-mail :: ".$rvar_Email."\n";
$mailbody .= str_repeat("-", 80)."\n";
$mailbody .= "Suscripción de Newsletters - site www.midominio.com\n";
@mail($rvar_To,$rvar_Subject,
$mailbody,
"From: \"".$rvar_Email."\" <".$rvar_Email.">\r\n"
."Reply-To: \"".$rvar_Email."\" <".$rvar_Email.">\r\n"
."X-Mailer: Administrador - Dominio - PHP/".phpversion()."");
$page_title = "Suscripción de Newsletters";
$page_body_1 = "<br><br>Su suscripción fue enviada correctamente.\n";
$page_button = "Dominio";
$site = "[email protected]";
mail("$rvar_Email","Gracias por Visitarnos",
"Hola,
Gracias por su interés en www.midominio.com
BLA BLA BLA link http://-------------Y elija que información desea recibir
Desde ya agradecemos por su tiempo.
Saluda atte.,
Dominio
http://www.midominio.com","From: $site");
}
else {
$page_title = "Suscripción de Newsletters - error! ";
$page_body_1 = "<br><br>Por favor, <strong>Llene correctamente</strong> todos los campos solicitados!<br>Muchas gracias.\n";
}
?>
</body>
</html>
Sin embargo, antes utilizaba la función mail(), la cual ahora debería reemplazar para no tener errores, pero no encuentro cual es la forma de hacerlo en phpmailer.
Alguna idea?? Gracias |