Advertisement
Guest User

Untitled

a guest
Jul 14th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['submit']))
  3. {
  4.  
  5. //The form has been submitted, prep a nice thank you message
  6. $output = '<h1>Thanks for your file and message!</h1>';
  7. //Set the form flag to no display (cheap way!)
  8. $flags = 'style="display:none;"';
  9.  
  10. //Deal with the email
  11. $to = 'xxxx@gmail.com';
  12. $subject = 'Details and file attachments ';
  13.  
  14. $message = strip_tags($_POST['message']);
  15. $attachment = (file_get_contents($_FILES['file']['tmp_name']));
  16. $filename = $_FILES['file']['name'];
  17.  
  18. $boundary =md5(date('r', time()));
  19.  
  20. $headers = "From: xxxxxx@gmail.comrnReply-To: xxxxxxx@gmail.com";
  21. $headers .= "rnMIME-Version: 1.0rnContent-Type: multipart/mixed; boundary="_1_$boundary"";
  22.  
  23. $message="This is a multi-part message in MIME format.
  24.  
  25. --_1_$boundary
  26. Content-Type: multipart/alternative; boundary="_2_$boundary"
  27.  
  28. --_2_$boundary
  29. Content-Type: text/plain; charset="iso-8859-1"
  30. Content-Transfer-Encoding: 7bit
  31.  
  32. $message
  33.  
  34. --_2_$boundary--
  35. --_1_$boundary
  36. Content-Type: application/octet-stream; name="$filename"
  37. Content-Transfer-Encoding: base64
  38. Content-Disposition: attachment
  39.  
  40. $attachment
  41. --_1_$boundary--";
  42.  
  43. mail($to, $subject, $message, $headers);
  44. }
  45. ?>
  46.  
  47. <td height="12"> <?php echo $output; ?>
  48. <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" <?php echo $flags;?>>
  49. <fieldset>
  50. <legend>Submit your interest</legend>
  51. <p><label class="title" for="name">Your name:</label>
  52. <input type="text" name="name" id="name"><br /></p>
  53. <p> <label class="title" for="email">Your email:</label>
  54. <input type="text" name="email" id="email"></p>
  55. <p> <label class="title" for="phone">Your phone:</label>
  56. <input type="number" name="phone" id="phone"></p>
  57. <p><label for="location" class="title">Total Experience :</label>
  58. <select name="location" id="location">
  59. <option value="ny">1</option>
  60. <option value="il">2</option>
  61. <option value="ca">3+</option>
  62. </select></p>
  63. <span class="title">Upload your resume</span>
  64. <input type="file" name="resume" />
  65. </p>
  66. </fieldset>
  67. <div><input type="submit" name="submit" id="submit" value="send"></div>
  68. </form></td>
  69.  
  70. http://www.html-form-guide.com/email-form/php-email-form-attachment.html/
  71.  
  72. Content-Transfer-Encoding: base64
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement