PHP Mail spoofer script


SUBMITTED BY: Guest

DATE: Dec. 13, 2013, 2:30 p.m.

FORMAT: PHP

SIZE: 3.9 kB

HITS: 849

  1. <?php
  2. //fake mail sender
  3. define("PASSWORD","mahnamahna");
  4. $validpw = false;
  5. if(!isset($_POST['password']) || $_POST['password'] == '')
  6. {
  7. $mail = '<div style="color:red">You need a password to send mail. Be sure to enter it.</div>';
  8. $validpw = false;
  9. } elseif($_POST['password'] != PASSWORD)
  10. {
  11. $mail = '<div style="color:red">Invalid password.</div>';
  12. $validpw = false;
  13. } else {
  14. $validpw = true;
  15. }
  16. if(isset($_POST['to']) && isset($_POST['from']) && isset($_POST['fromname']) && isset($_POST['replyto']) && isset($_POST['subject']) && isset($_POST['message']) && $validpw)
  17. {
  18. $headers = 'From: '.$_POST['fromname'].' <'.$_POST['from'].'>' . "\r\n" .
  19. 'Reply-To: '. $_POST['replyto'] . "\r\n";
  20. $mail = mail($_POST['to'],$_POST['subject'],$_POST['message'],$headers);
  21. if($mail)
  22. {
  23. $mail = '<div style="color:green">Mail sent.</div>';
  24. } else {
  25. $mail = '<div style="color:red">Error</div>';
  26. }
  27. } else {
  28. if(!isset($mail))
  29. {
  30. $mail = '<div style="color:red">Fill in all inputs</div>';
  31. }
  32. }
  33. ?>
  34. <!DOCTYPE html>
  35. <html>
  36. <head>
  37. <title>Email Sender</title>
  38. </head>
  39. <body>
  40. <?php echo $mail; ?>
  41. <form action="index.php" method="post">
  42. <table border="0">
  43. <tr>
  44. <td>To: </td>
  45. <td><input type="text" name="to"></td>
  46. </tr>
  47. <tr>
  48. <td>Fake From Email: </td>
  49. <td><input type="text" name="from"></td>
  50. </tr>
  51. <tr>
  52. <td>Fake From Name: </td>
  53. <td><input type="text" name="fromname"></td>
  54. </tr>
  55. <tr>
  56. <td>Reply to: </td>
  57. <td><input type="text" name="replyto"></td>
  58. </tr>
  59. <tr>
  60. <td>Subject: </td>
  61. <td><input type="text" name="subject"></td>
  62. </tr>
  63. <tr>
  64. <td>Message: </td>
  65. <td><textarea name="message"></textarea></td>
  66. </tr>
  67. <tr>
  68. <td>Password: </td>
  69. <td><input type="password" name="password"></td>
  70. </tr>
  71. <tr>
  72. <td colspan="2">
  73. <input type="submit" value="Send Email" />
  74. </td>
  75. </tr>
  76. </table>
  77. </form>
  78. </body>
  79. </html>

comments powered by Disqus