correo con phpmailer
Publicado por zendi (1058 intervenciones) el 12/12/2014 00:27:09
Que tal a todos creé estos codigos: el formulario correomail.php y el que procesa : enviar.php
Nota: En este caso no arroja mensaje de ningun tipo.
si pùeden ayudarme.
este es correomail.php
y enviar.php:
Nota: En este caso no arroja mensaje de ningun tipo.
si pùeden ayudarme.
este es correomail.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
form {
margin: 1em auto;
text-align: center;
}
span{
color: #F60;
font-size: 1.5 em;
}
</style>
</head>
<body>
<form name="mail_frm" method="post" enctype="multipart/form-data" action="enviar.php">
De:<input type="text" name="de_txt" /> <br/> <br/>
Para:<input type="text" name="para_txt" /> <br/> <br/>
Asunto:<input type="text" name="asunto_txt" /> <br/> <br/>
Adjuntar Archivo: <input type="file" name="archivo_fls" /> <br/> <br/>
Mensaje:<br /><textarea name= "mensaje_txa"/> </textarea> <br/> <br/>
<input type="submit" name="enviar_btn" value="Enviar"/><br/>
<?php
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
if(isset($_GET["respuesta"])){
echo "<span>".$_GET["respuesta"] ."</span>";
}
?>
</form>
</body>
</html>
y enviar.php:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
$de = $_POST["de_txt"];
$para = $_POST["para_txt"];
$asunto = $_POST["asunto_txt"];
$mensaje = $_POST["mensaje_txa"];
$archivo = $_FILES["archivo_fls"]["tmp_name"];
$destino = $_FILES["archivo_fls"]["name"];
if(move_uploaded_file($archivo,$destino)){
include_once("phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = "ssl://smtp.live.com";
$mail->Port = 25;
$mail->From = $de;
$mail->AddAddress($para);
$mail->Username = "alecuello84@hotmail.com";
$mail->Password = "wwwww"; //
$mail->Subject = $asunto;
$mail->Body = $mensaje;
$mail->WordWrap = 50;
$mail->Timeout=30;
$mail->IsHTML(true);
$mail->MsgHTML($mensaje);
$mail->AddAttachment($destino);
if ($mail->Send())
{
$respuesta ="El mensaje ha sido enviado";
}
else
{
$respuesta ="El mensaje no se pudo enviar";
$respuesta .="Error: " .$mail->ErrorInfo;
}
}
else
{
$respuesta = "Ocurrio un error";
}
header("Location:correomail.php?respuesta=$respuesta");
?>
Valora esta pregunta


0