Revision: 52988
Updated Code
at November 22, 2011 04:03 by juanprimal
Updated Code
<?php if (!isset($_POST['email'])): ?> <form id="form1" name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>"> <p> <label>Nombre:<br /> <input type="text" name="nombre" id="nombre" size="50"/> </label> </p> <p> <label>Apellido:<br /> <input type="text" name="apellido" id="apellido" size="50"/> </label> </p> <p> <label>Email:<br /> <input type="text" name="email" id="email" size="50"/> </label> </p> <p> <label>Telefono:<br /> <input type="text" name="tel" id="tel" size="50"/> </label> </p> <p> <label>Mensaje:<br /> <textarea name="mensaje" id="mensaje" cols="45" rows="5"></textarea> </label> </p> <p> <label> <input type="submit" name="button" id="button" value="Enviar" /> </label> </p> </form> <? else: require_once 'class.phpmailer.php'; $mail = new PHPMailer (); $mail->IsSMTP(); $mail->Host = 'ssl://smtp.gmail.com'; $mail->Port = 465; $mail->SMTPAuth = true; $mail->Username = '[email protected]'; $mail->Password = '*****'; $mail -> From = $_POST[email]; $mail -> FromName = $_POST[nombre]; $mail -> AddAddress ("[email protected]"); //$mail -> AddAddress ("[email protected]"); $mail -> Subject = "Formulario de Contacto"; $body = "<strong>Nombre:</strong> $_POST[nombre] $_POST[apellido]<br>"; $body .= "<strong>Email:</strong> $_POST[email]<br>"; $body .= "<strong>Telefono:</strong> $_POST[tel]<br>"; $body .= $_POST[mensaje]; $mail->Body = $body; $mail->AltBody = "Mensaje:"; $mail->AddReplyTo($_POST[email], $_POST[name]); $mail->Send(); echo"<p>Tu solicitud se envió con exito.</p>"; endif; ?>
Revision: 52987
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 9, 2011 03:54 by juanprimal
Initial Code
<?php require_once 'class.phpmailer.php'; $mail = new PHPMailer (); $mail -> From = "[email protected]"; $mail -> FromName = "Foo"; $mail -> AddAddress ("[email protected]"); $mail -> Subject = "Test"; $mail -> Body = "<h3>From GMail!</h3>"; $mail -> IsHTML (true); $mail->IsSMTP(); $mail->Host = 'ssl://smtp.gmail.com'; $mail->Port = 465; $mail->SMTPAuth = true; $mail->Username = '[email protected]'; $mail->Password = '******'; if(!$mail->Send()) { echo 'Error: ' . $mail->ErrorInfo; } else { { echo 'Mail enviado!'. } ?>
Initial URL
Initial Description
Initial Title
Emails con smtp phpmailer y servidores de gmail
Initial Tags
Initial Language
PHP