Advertisement
Guest User

Untitled

a guest
Sep 14th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['tomail'])){
  3.  
  4. $to = $_POST['tomail'];
  5.  
  6. // subject
  7. $subject = $_POST['subject'];
  8.  
  9. // message
  10. $message = $_POST['msg'];
  11.  
  12. $headers = '';
  13. // // To send HTML mail, the Content-type header must be set
  14. $headers = 'MIME-Version: 1.0' . "\r\n";
  15. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  16.  
  17. // Additional headers
  18. $headers .= 'To: '.$_POST['toname'].' <'.$_POST['tomail'].'>' . "\r\n";
  19. $headers .= 'From: '.$_POST['fromname'].' <'.$_POST['frommail'].'>' . "\r\n";
  20.  
  21. // Mail it
  22.  
  23. mail($to, $subject, $message, $headers);
  24. $send = true;
  25. }
  26. ?>
  27. <!DOCTYPE html>
  28. <html>
  29. <head>
  30. <title>Send mail</title>
  31. <style>
  32. *{
  33. margin: 5px 0;
  34. padding: 0;
  35. box-sizing: border-box;
  36. }
  37. p{
  38. font-size: 32px;
  39. width: 100%;
  40. text-align: center;
  41. position: absolute;
  42. top: 30px;
  43. left: 0;
  44. }
  45. form{
  46. width: 500px;
  47. margin: 100px auto;
  48. }
  49. form input,
  50. form textarea{
  51. width: 100%;
  52. border: 1px solid black;
  53. padding:10px;
  54. background: white;
  55. color: black;
  56. font-size: 20px;
  57. }
  58.  
  59. </style>
  60. </head>
  61. <body>
  62. <?php if($send) echo "<p>Mail sent successfuly :D</p>"; ?>
  63. <form action="mail.php" method='post'>
  64. <input type='email' name='tomail' placeholder='Send to["email"]...'>
  65. <input type='text' name='toname' placeholder='Send to["name"]...'>
  66. <input type='text' name='subject' placeholder='Subject...'>
  67. <input type='text' name='fromname' placeholder='From["name"]'>
  68. <input type='email' name='frommail' placeholder='From["email"]'>
  69. <textarea name="msg" placeholder='Message...'></textarea>
  70. <input type="submit" value='send'>
  71. </form>
  72. </body>
  73. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement