PHPMailer

Hola David, queria saber si sbes o has escuchado de esta clase PHPMailer para mandar emails, si sabes avisame para hacerte una consulta
GRacias

1 Respuesta

Respuesta
1
Lo único que sé es que se trata de una librería para enviar correo, como hace la orden mail() de PHP pero algo más especializada en algunos aspectos.
ah ok... es que me da este error pero no se si me puedas ayudar Parse error: syntax error, unexpected $end in /home/comepris/public_html/envio/correo3.php on line 152?
Quizás si pudiera ver las líneas de la 150 a la 155 de ese fichero...
El problema es uqe mi codigo no tiene linea 150, aquie esta el codigo por si lo puedes ver , gracias
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0085)http://www.webtaller.com/construccion/lenguajes/css/lecciones/maquetar_css_final.html -->
<HTML><HEAD><TITLE>PUBLIWEB - Correo de PubliWebCr</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8"><LINK
href="diseno.css"
type=text/css rel=STYLESHEET>
<META content="MSHTML 6.00.2900.2523" name=GENERATOR>
<style type="text/css">
<!--
body {
background-image: url(images/galeria_03.jpg);
}
.style3 {color: #FFFFFF}
.style4 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
</HEAD>
<BODY>
<DIV id=contenedor>
<DIV id=cabecera>
<div align="center"><img src="images/galeria_02.jpg" width="623" height="203"></div>
</DIV>
<DIV id=cuerpo>
<?php
if($_POST['Submit']){
// Get the Variables From the Form
include_once('class.phpmailer.php');
$mail = new PHPMailer(); // defaults to using php "mail()"
$body = $mail->getFile('contents.html');
$body = eregi_replace("[\]",'',$body);
$mail->From = "[email protected]";
$mail->FromName = "Diseño";
$mail->Subject = "Le ofrecemos la mejor opcion para su negocio";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$name = $_POST['name'];
$email = $_POST['email'];
$bcc = $_POST['bcc'];
$mail->AddAddress($_POST['email']); // dirrecciones a las que se va a mandar el mail
$mail->AddBCC($_POST['bcc']);
//$mail->AddAttachment("images/bolante.jpg"); // Archivo adjuto
$mail->AddEmbeddedImage("images/bolante.jpg", "Visitenos", "images/bolante.jpg");
$mail->Body = 'Embedded Image: <img alt="PHPMailer" src="cid:my-attach"> Here is an image!';
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
<div align="center">
<table width="488" border="0" cellpadding="1" cellspacing="1">
<tr>
<th scope="col"><span class="style3">Por favor digite el nombre y email de la pesona o empresa que desea enviar este email, luego prescione el botón de ENVIAR CORREO </span><br></th>
</tr>
</table>
</div>
<form id="contact" name="contact" action="<? echo $_SERVER['class/PHP_SELF'];?>" method="post" onSubmit="return validateme(this)">
<div align="center">
<table width="600" border="0" cellpadding="2" cellspacing="2">
<tr>
<th width="141" scope="col">
<div align="left" class="style3"><b>Nombre</b></div>
</th>
<th width="318" scope="col">
<div align="left">
<input name="name" type="text" id="namefrom" size="50" maxlength="50" />
</div>
</th>
</tr>
<tr>
<th scope="row">
<div align="left" class="style4">Tu E-mail</div>
</th>
<td><input name="email" type="text" id="email" size="50" maxlength="50" /></td>
</tr>
<tr>
<th scope="row">
<div align="left" class="style4">BCC</div>
</th>
<td><textarea name="bcc" cols="50" id="bcc"></textarea></td>
</tr>
<tr>
<th scope="row"> </th>
<td>
<div align="right"> </div>
</td>
</tr>
<tr>
<th scope="row"> </th>
<td>
<div align="right">
<input type="submit" name="Submit" value="Enviar Correo" />
</div>
</td>
</tr>
</table>
</div>
</form>
</DIV>
</DIV>
</DIV>
</BODY>
</HTML>
¿Al abrir la etiqueta <?php tienes un if que abre un corchete y que no cierras.
¿Antes de la etiqueta?> Deberías cerrar un corchete adicional.
tienes razon... pero no creo que eso genera el error o si  ?
Pues si: el parser busca el final del if y encuentra 'inseperadamente' el final del fichero, que es exactamente el error que dice.
Hola David...
Hice el arreglo que me dijiste pero aun asi me daba el mismo error, pero vi algo curioso, talvez tu me puedas ayudar a encontrar el error , le quite esta parte en comentarios y funciono
//$name = $_POST['name'];
//$email = $_POST['email'];
//$bcc = $_POST['bcc'];
Pero mi intencion es poder poner digitar las direcciones y mandarlas, gracias por las sugerencias
<?php
if($_POST['Submit']){
// Get the Variables From the Form
include_once('class.phpmailer.php');
$mail = new PHPMailer(); // defaults to using php "mail()"
$body = $mail->getFile('contents.html');
$body = eregi_replace("[\]",'',$body);
$mail->From = "[email protected]";
$mail->FromName = "Diseño";
$mail->Subject = "Le ofrecemos la mejor opcion para su negocio";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
//$name = $_POST['name'];
//$email = $_POST['email'];
//$bcc = $_POST['bcc'];
$mail->AddAddress("[email protected]"); // dirrecciones a las que se va a mandar el mail
$mail->AddBCC("[email protected]");
$mail->AddAttachment("images/bolante.jpg"); // Archivo adjuto
//$mail->AddEmbeddedImage("images/bolante.jpg", "TEST", "images/bolante.jpg");
//$mail->Body = 'Embedded Image: cid:my-attach Here is an image!';
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
}
?>
No hace falta que comentes esas tres líneas. Tiene que funcionar igualmente.
Esas tres líneas tienen una sintaxis correcta. Simplemente asignar valores a variables. Si no existiesen los valores post, las variables estarían vacías pero nada más.
Prueba a descomentarlas y tiene que funcionar.
Hola David
Despues de tus consejos, lo volvi a chequear y hacer mas pruebas y ya me funiono de lo mas bien... aqui te lo pongo por si lo quiere, muchas gracas
<?php
if($_POST['Submit']){
// Get the Variables From the Form
include_once('class.phpmailer.php');
$email = $_POST['email'];
$bcc = $_POST['bcc'];
$subject = $_POST['subject'];
$mail = new PHPMailer(); // defaults to using php "mail()"
$mail->From = "[email protected]";
$mail->FromName = "Diseno Web - Publiwebcr.com";
$mail->ConfirmReadingTo= "[email protected]";
$mail->Timeout=120;
$mail->Subject = $subject;
$body = $mail->getFile('contents.html');
$body = eregi_replace("[\]",'',$body);
$mail->AltBody = "Favor ver este email con IE o Mozilla"; // optional, comment out and test
$mail->MsgHTML($body);
$mail->AddAddress($email); // dirrecciones a las que se va a mandar el mail
$mail->AddBCC($bcc);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
}
?>
Me alegro de que funcione y gracias por el código que puede servir a otros que tengan este mismo problema.
Por favor, puntua la respuesta para que se pueda cerrar la pregunta.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas