Advertisement
Guest User

Untitled

a guest
May 9th, 2015
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. <?php include "_header.php" ?>
  2.  
  3. <?php
  4.  
  5.  
  6. $asunto= $_POST["asunto"];
  7. $mensaje=$_POST["mensaje"];
  8. $mail=$_POST["mail"];
  9. $multiples=$_POST["multiples"];
  10.  
  11.  
  12.  
  13. if(isset($_POST["Enviar"])) {
  14.  
  15.  
  16. $resultado=$asunto.$mensaje.$mail.$multiples;
  17.  
  18. email_classic("anampl83@gmail.com", "anampl", "anampl83@gmail.com", "anampl", "prueba mail", "mi mensaje");
  19.  
  20. $direcciones=$_POST["direcciones"];
  21.  
  22.  
  23. // trim quita espacios del principio y del final.
  24. $text= trim($direcciones);
  25.  
  26. // explora y convierte todas las lineas (mails) en un array
  27. $arraydirecciones= explode("\n", $text);
  28.  
  29.  
  30. // quita espacios entre lineas
  31. $arraydirecciones= array_filter($arraydirecciones, 'trim');
  32.  
  33. foreach ($arraydirecciones as $direcciones) {
  34. email_classic("anampl83@gmail.com", "anampl", $direcciones, "pepito", "mi mensaje", "hola");
  35. }
  36.  
  37.  
  38.  
  39.  
  40. }
  41.  
  42.  
  43.  
  44. function email_classic($from, $from_name, $to, $to_name, $subject, $message){
  45.  
  46. $from = $from_name. "<".$from.">\n";
  47.  
  48. $headers = "From: {$from}". "\n";
  49. $headers .= "Reply-To: {$from}". "\n";
  50. $headers .= "Cc: {$to}\n";
  51. $headers .= "Bcc: {$to}\n";
  52. $headers .= "X-Mailer: PHP/".phpversion()."\n";
  53. $headers .= "MIME-Version: 1.0". "\n";
  54. $headers .= "Content-Type: text/plain; charset=iso-8859-1";
  55.  
  56. $result = mail($to, $subject, $message, $headers);
  57.  
  58. echo $result ? 'Message sent!' : 'Mailer Error';
  59. }
  60.  
  61. ?>
  62.  
  63.  
  64.  
  65. <div class="well">
  66. <form action="correo.php" method="post"><br>
  67.  
  68.  
  69.  
  70. <div class="row">
  71. <div class="col-xs-5 col-xs-offset-1 columna">
  72.  
  73. <div class="well">
  74. Asunto: <input type="text" name="asunto" value="" /><br>
  75. <br>
  76. Mensaje:<br>
  77. <br>
  78. <textarea name="mensaje" id=" " value="mensaje" cols="32" rows="15" ></textarea>
  79. <br>
  80. @ e-mail:<br>
  81. <input type="text" name="mail" value="" />
  82. <br>
  83. <br>
  84.  
  85.  
  86.  
  87.  
  88.  
  89. <input type="Checkbox" value="multiples" /> múltiples &nbsp &nbsp &nbsp &nbsp<input type="submit" name="Enviar" value="enviar"/>
  90.  
  91.  
  92. </div>
  93. </div>
  94.  
  95. <div class="col-xs-5 col-xs-offset-0 columna">
  96. <div class="well">
  97. E-mails @ <br>
  98. <br>
  99. <textarea name="direcciones" id=" " cols="32" rows="22" ></textarea>
  100.  
  101. </div>
  102.  
  103. </div>
  104.  
  105. </div>
  106.  
  107.  
  108.  
  109. </form>
  110.  
  111.  
  112. </div>
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120. <?php include "_footer.php" ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement