Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. require '/PHPMailer-master/PHPMailerAutoload.php';
  2. require '/PHPMailer-master/class.phpmailer.php';
  3.  
  4. $mail = new PHPMailer;
  5.  
  6. if(isset($_POST['submit'])){
  7. $to = "me@mymail.com";
  8. $from = $_POST['text_96'];
  9. $fullname = $_POST['text_95'];
  10. $email = $_POST['text_96'];
  11. $dob = $_POST['date_12'];
  12. $addr = $_POST['textarea_31'];
  13. $maths = $_POST['text_93'];
  14. $english = $_POST['text_31'];
  15. $holidayst = $_POST['date_74'];
  16. $holidayend = $_POST['date_91'];
  17. $distance = $_POST['number_58'];
  18. $awayhome = $_POST['selectlist_90'];
  19.  
  20. foreach($_POST['checkbox'] as $key=>$val){$apprent .= $val.' ';}
  21. //$fileatt = $_POST['file'];
  22. $reasontext = $_POST['textarea_60'];
  23. $message = "Message";
  24.  
  25. $mail->setFrom($from, $fullname);
  26. $mail->addAddress('me@mymail.com');
  27. $mail->addAttachment($_FILES['file']['name']);
  28.  
  29. if (isset($_FILES['file']) &&
  30. $_FILES['file']['error'] == UPLOAD_ERR_OK) {
  31. $mail->AddAttachment($_FILES['file']['tmp_name'],
  32. $_FILES['file']['name']);
  33. }
  34.  
  35. $mail->Subject = 'subject';
  36. $mail->Body = $message;
  37.  
  38. if(!$mail->send()) {
  39. $message = NULL;
  40. $headers = NULL;
  41. header('Location: success.html');
  42. } else {
  43. $message = NULL;
  44. $headers = NULL;
  45. header('Location: error.html');
  46. }
  47.  
  48. if(!$mail->send()) {
  49. $message = NULL;
  50. $headers = NULL;
  51. header('Location: success.html');
  52. } else {
  53. $message = NULL;
  54. $headers = NULL;
  55. header('Location: error.html');
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement