Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if( isset($_POST["boton"]) && !strcmp($_POST["boton"], "Enviar") )
- {
- echo '<span>';
- $boundary= md5(time()); //valor boundary
- $htmlalt_boundary= $boundary. "_htmlalt"; //boundary suplementario
- $subject=$_POST["asunto"];
- $from= $_POST["from"];
- $to= $_POST["to"];
- if( !empty($_POST["return_path"]) )
- $extra_arg= '-f'. $_POST["return_path"];
- else $extra_arg= NULL;
- //cabeceras para enviar correo en formato HTML
- $headers = "MIME-Version: 1.0\r\n";
- $headers .= "Content-Type: multipart/mixed; boundary=\"". $boundary. "\"\r\n"; //datos mixteados
- $headers .= "From: ". $from. "\r\n"; //correo del que lo envia
- //incia cuerpo del mensaje que se visualiza
- $cuerpo="--". $boundary. "\r\n";
- $cuerpo .= "Content-Type: multipart/alternative; boundary=\"". $htmlalt_boundary. "\"\r\n\r\n"; //contenido alternativo: texto o html
- $cuerpo .= "--". $htmlalt_boundary. "\r\n";
- $cuerpo .= "Content-Type: text/html; charset=iso-8859-1\r\n";
- $cuerpo .= "Content-Transfer-Encoding: 8bits\r\n\r\n";
- $cuerpo .= $_POST["mensaje"];
- $cuerpo .= "\r\n\r\n";
- $cuerpo .= "--". $htmlalt_boundary. "--\r\n\r\n"; //fin cuerpo mensaje a mostrar
- $cuerpo .= "--". $boundary. "--\r\n\r\n";
- if( mail($to, $subject, $cuerpo, $headers, $extra_arg) )
- echo 'Correo enviado con exito...';
- else
- echo 'Error al enviar...';
- echo '</span>';
- }
- echo '<table>
- <form action="sendmail.php" method="POST">
- <td>From:</td><td><input type="text" name="from"></td><tr>
- <td>To:</td><td><input type="text" name="to"></td><tr>
- <td>Return-Path:</td><td><input type="text" name="return_path"></td><tr>
- <td>Asunto:</td><td><input type="text" name="asunto"></td><tr>
- <td colspan="2">Mensaje:</td><tr>
- <td colspan="2"><textarea name="mensaje"></textarea></td><tr>
- <td colspan="2"><input type="submit" name="boton" value="Enviar"></td>
- </form>
- </table>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement