Advertisement
cedrea

PHP Mass Mailer

Nov 20th, 2014
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.02 KB | None | 0 0
  1. <?php
  2.  
  3. if( $_SERVER['REQUEST_METHOD'] === 'POST' ){
  4.     $emails = explode(',', $_POST['mailuri']);
  5.     foreach( $emails as $email ){
  6.         $headers = "MIME-Version: 1.0";
  7.         $headers .= "Content-type: text/plain; charset=iso-8859-1";
  8.         $headers .= "From: " . $_POST["numele_tau"] . " <" . $_POST["mail_tau"] . ">";
  9.         $headers .= "Bcc: " . $email;
  10.         $headers .= "Reply-To: <" . $_POST["replyto"] . ">";
  11.         $headers .= "Subject: " . $_POST["subject"];
  12.         if($_POST["epriority"]==1){
  13.             $headers .= "X-Priority: 1 (Highest)";
  14.             $headers .= "X-MSMail-Priority: High";
  15.             $headers .= "Importance: High";
  16.         }elseif($_POST["epriority"]==3){
  17.             $headers .= "X-Priority: 5 (Lowest)";
  18.             $headers .= "X-MSMail-Priority: Low";
  19.             $headers .= "Importance: Low";
  20.         }      
  21.         $headers .= "X-Mailer: PHP/".phpversion();
  22.         mail($email, $_POST["subject"], $_POST["text_mail"], $headers);    
  23.     }
  24.     header('Location: mail.php');
  25. }
  26.  
  27. ?>
  28. <form action='' method="POST">
  29. <table>
  30. <tr>
  31. <td>
  32. Emails :</br><textarea name="mailuri" cols="50" rows="15" maxlength="10000" wrap="soft"></textarea></td><td>
  33. <table><tr><td>
  34.     Your Email : </br><input type="text" name="mail_tau" size="40"></td></tr><tr><td>
  35.     Your Name : </br><input type="text" name="numele_tau" size="40"></td></tr><tr><td>
  36.     Reply-To : </br><input type="text" name="replyto" size="40"></td></tr><tr><td>
  37.     Subject : </br><input type="text" name="subject" size="40"></td></tr><tr><td>
  38.     Email Priority : </br><select name="epriority">
  39.         <option selected="" value="">- Please Choose -</option>
  40.         <option value="1">High</option>
  41.         <option value="2">Normal</option>
  42.         <option value="3">Low</option>
  43.     </select>
  44. </td></tr></table></td></tr></table></td></tr><tr><td>
  45. Your Text : </br><textarea name="text_mail" cols="86" rows="15" maxlength="10000" wrap="soft"></textarea></td>
  46. </td></tr></table></br>
  47. <input type="Submit" value="Send Emails">
  48. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement