Código PHP:
<?php
include("class.phpmailer.php");
include("class.smtp.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "[email protected]";
$mail->Password = "123456";
$mail->From = "mi [email protected]";
$mail->FromName = "mi web";
$mail->Subject = "mi web";
$mail->AltBody = "Hola, te doy mi nuevo numero\nxxxx.";
$mail->MsgHTML("<b>Nombre:</b> ".$_POST['nombre']."<br/> <b>Telefono:</b> ".$_POST['telefono']."<br/> <b>Email:</b> ".$_POST['email']."<br/> <b>Telefono:</b> ".$_POST[mensaje]."<br/>");
$mail->AddAttachment("files/files.zip");
$mail->AddAttachment("files/img03.jpg");
$mail->AddAddress("[email protected]", "German gonzales");
$mail->IsHTML(true);
if(!$mail->Send()) {
echo "Error: " . $mail->ErrorInfo;
} else {
echo "Mensaje enviado correctamente";
}
?>
Código HTML:
<form action="phpmailer-gmail/index.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <p>Nombre:<br /> <label> <input name="nombre" type="text" id="nombre" /> </label> <br /> Telefono:<br /> <input name="telefono" type="text" id="telefono" /> <br /> Email:<br /> <input name="email" type="text" id="email" /> <br /> Mensaje:<br /> <textarea name="mensaje" id="mensaje"></textarea> </p> <p> <label> <input name="archivo" type="file" id="archivo" /> </label> <br /> <br /> <label> <input type="submit" name="Submit" value="Enviar Formulario" /> </label> </p> </form>
GRACIAS