Ver Mensaje Individual
  #3 (permalink)  
Antiguo 18/10/2010, 13:07
Avatar de Night_Wolf
Night_Wolf
 
Fecha de Ingreso: octubre-2010
Mensajes: 6
Antigüedad: 13 años, 6 meses
Puntos: 1
Respuesta: Botón examinar que se envíe a mail

Ok, me explico mejor. He encontrado que la solución es PHPMailer. Ya descargué un código que es el siguiente:

Código PHP:
<?php
require("class.phpmailer.php");
$msg "";
if (
$_POST['action'] == "send") {
    
$varname $_FILES['archivo']['name'];
    
$vartemp $_FILES['archivo']['tmp_name'];
    
    
$mail = new PHPMailer();
    
$mail->Host 'localhost';
    
$mail->From '[email protected]';
    
$mail->FromName "Blog Unijimpe";
    
$mail->Subject $_POST['asunto'];
    
$mail->AddAddress($_POST['[email protected]']);
    if (
$varname != "") {
        
$mail->AddAttachment($vartemp$varname);
    }
    
$body "<strong>Mensaje</strong><br><br>".$_POST['mensaje']."<br>";
    
$body.= "<i>Enviado por http://blog.unijimpe.net</i>";
    
$mail->Body $body;
    
$mail->IsHTML(true);
    
$mail->Send();
    
$msg "Mensaje enviado correctamente";
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PHP Email Attach</title>
<link href="mailattach.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" class="descdet">
    <div class="borde">
    <strong class="subder">Env&iacute;ar Email con Adjuntos</strong><br>
    Ingresar los datos en el formulario. <br>
    <?php if ($msg != "") { ?><span class="conf"><?php echo $msg?></span><br><?php ?>
    <form action="mailattach.php" method="post" enctype="multipart/form-data">
      <p>      Destinatario<br>
      <input type="text" name="destino" size="50">
      Asunto<br>
      <input type="text" name="asunto" size="50">
      Adjunto<br>
      <input type="file" name="archivo"  size="32">
      Mensaje<br>
      <textarea name="mensaje" cols="47" rows="8" wrap="virtual" id="mensaje"></textarea>
      <input type="submit" name="btsend" class="boton" value="Enviar Email">
      <input type="hidden" name="action" value="send" />
      </p>
    </form>
    </div>
    </td>
  </tr>
</table>
</body>
</html>
Ya coloqué los 3 archivos en el servidor (éste y los dos de PHPMailer), pero no se envía nada a mi mail.

Cita:
Iniciado por pateketrueke Ver Mensaje
¿novato?

y si te ocurrió tal ves buscar en el foro un tema similar antes de preguntar?
pateketrueke, obviamente se me ha ocurrido buscar. Sin embargo, no encuentro una solución que la pueda adaptar al problema que tengo.

Repito, soy novato en el tema, y tal vez la información que encontré es la solución, pero YO NO SÉ cómo adaptarla. Por tanto, al no saber, creí competente preguntar en este FORO. Así que sinceramente encuentro fuera de lugar tu comentario, pues si te tomaste el tiempo de escribirlo, por lo menos pudiste haber colocado una solución.