Advertisement
Fray117

Mini PHP Mailer

Jul 29th, 2018
4,302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.61 KB | None | 0 0
  1. <?php
  2. function clean($string) {$bad = array("content-type","bcc:","to:","cc:","href");return str_replace($bad, "", $string);}?>
  3.       <head>
  4.         <meta charset="UTF-8"><meta name="author" content="Agus Setya R"><meta name="application-name" content="Mailer"><meta name="description" content="Send mail with this tools, be anonymous and send massive mail in one time."><meta name="viewport" content="width=device-width, initial-scale=1.0">
  5.         <style type="text/css">
  6.         html{background-color:#000000}.credit{color: #FFFFFF;font-family: monospace;font-size: 15px;position:absolute;;left:50%;bottom:0;transform:translate(-50%,0%);-ms-transform:translate(-50%,0%)}html {margin: 10px auto;color: #FFFFFF;}h1 {font-size: 50px;text-align: center;margin: 0px auto;font-family: monospace;font-weight: lighter;}.mailer[type=text]{background: #FFFFFF;padding: 7px;margin: 5px auto;margin-left: 30px;border: 0;border-bottom: 1px solid #000000;color: #000000;width: 250px;height: 50px;font-family: monospace;font-size: 20px;}.btn {border-style: none;color: #FFFFFF;width: 90%;height: 50px;background-color: transparent;text-decoration: none;font-family: monospace;font-size: 20px;position:absolute;left:50%;transform:translate(-50%,0%);-ms-transform:translate(-50%,0%)}.btn:hover {cursor: default;text-decoration: none;background-color: #FFFFFF;color: #000000;}table {margin-left: 30px;font-size: 20px;}textarea {color: #000000;background: whitesmoke;padding: 5px;resize: none;border: 1px solid #000000;width: 550px;height: 250px;outline: none;font-family: monospace;font-size: 18px;}
  7.         </style>
  8.       </head>
  9.       <body>
  10.         <div>
  11.           <h1>Mailer v0.1</h1>
  12.           <table width="95%" align="center">
  13.             <form class="mailer" method="post" enctype="multipart/form-data">
  14.               <tr><td><pre>Subject   : <input type="text" name="subject" required></td></tr>
  15.               <tr><td><pre>Name      : <input type="text" name="from_name" required></td></tr>
  16.               <tr><td><pre>Email     : <input type="text" name="from_email" required></td></tr><br>
  17.               <!-- <tr><td><pre>CC        : <input type="text" name="cc" placeholder="email@mail.ltd" required></td></tr><br> -->
  18.               <tr><td><pre>Mail List : <br><textarea placeholder="reciepent@domain.ltd" name="mailist" required></textarea></td>
  19.               <td><pre>Letter  : <br><textarea placeholder="HTML Script" name="letter" required></textarea></td></tr>
  20.               <tr><td><input type="submit" class="btn" name="send" value="SEND"></td></tr>
  21.             </form>
  22.           </table>
  23.         </div>
  24.       </body>
  25.       <?php
  26.       $subject = htmlspecialchars(trim(clean($_POST['subject'])));
  27.       $name = htmlspecialchars(trim(clean($_POST['form_name'])));
  28.       $mail = htmlspecialchars(trim(clean($_POST['from_email'])));
  29.       // $cc = htmlspecialchars(trim($_POST['cc']));
  30.       $mailist = explode("\r\n", htmlspecialchars(clean($_POST['mailist'])));
  31.       $letter = $_POST['letter'];
  32.       $headers = "MIME-Version: 1.0" . "\r\n";
  33.       $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
  34.       $headers .= 'From: '.$name.'<'.$mail.'>' . "\r\n";
  35.       $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  36.       if (isset($_POST['send'])) { echo "<pre style='padding-left: 30px; font-size: 15px;'>"; foreach ($mailist as $mail) { if (!preg_match($email_exp, $mail)) { echo "Email <b>$mail</b> not valid.<br>"; } else { echo "Sending to <b>$mail</b> -> ";if (@mail($mail, $subject, $letter, $headers)) { echo "<font color=#00FF00>SUCCESS</font><br>";}else { echo "<font color=#ff0000>FAILED</font><br>"; }} } echo "</pre>";}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement