Ver Mensaje Individual
  #4 (permalink)  
Antiguo 28/11/2007, 09:30
chefnelone
 
Fecha de Ingreso: diciembre-2005
Ubicación: Barcelona
Mensajes: 1.428
Antigüedad: 18 años, 4 meses
Puntos: 15
Re: ayuda con phpMailer

Funciona bien.
Pero necesitaria que se pueda adjuntar archivos (este es el motivo de porque estoy usando phpmailer)

El problema es que no se como darle valor a $path (que deberia ser la ruta al archivo) y lo que se me ocurrio fue:
$path=$_POST['files_attached'];

que luego se usa en:
AddAttachment($path);

pero no funciona...

segun el tutorial sobre phpMailer:
$path is the path of the filename. It can be a relative one (from your script, not the PHPMailer class) or a full path to the file you want to attach.



CODIGO
<?php
if(isset($_POST['SUBMITTED'])){
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->Mailer = "mail";
$mail->From = "[email protected]";
$mail->AddAddress("[email protected]");

$mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! \n\n This is my third with attachment e-mail sent through PHPMailer.";
$mail->WordWrap = 50;

$path=$_POST['files_attached'];
AddAttachment($path);



if(!$mail->Send())
{
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
echo 'Message has been sent again.';
}
}else{echo "no pasa";}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<form action="index.php" method="post" enctype="multipart/form-data">
<input type="file" name="files_attached"/>
<input type="hidden" name="SUBMITTED"/>
<input type="submit" value="Send" />
</form>
</body>
</html>

Última edición por chefnelone; 28/11/2007 a las 09:36