Advertisement
Guest User

Untitled

a guest
Oct 10th, 2017
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. <?php
  2. if (array_key_exists('uploaded_file', $_FILES)) {
  3. require "PHPMailer-master/PHPMailerAutoload.php";
  4. $uploadfile = tempnam(sys_get_temp_dir(), hash('sha256', $_FILES['uploaded_file']['tmp_name']));
  5. if (move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $uploadfile)) {
  6.  
  7. $mail = new PHPMailer;
  8. $mail->isSMTP();
  9. // $mail->SMTPDebug = 2;
  10. $mail->SMTPAuth = true;
  11. $mail->SMTPSecure = "tls";
  12. $mail->Host = "smtp.gmail.com";
  13. $mail->Port = 587;
  14. /* $mail->Username = "noreplyemailar@gmail.com";
  15. $mail->Password = "N156Gsr4%";*/
  16. $mail->Username = "test.damiracle17@gmail.com";
  17. $mail->Password = "testdami123";
  18.  
  19.  
  20. $mail->From = "noreplyemailar@titagarh.in";
  21. $mail->AddAddress('mukesh.dayal@titagarh.in', 'mukesh');
  22. // $mail->AddAddress('anik.nag27@gmail.com', 'Anik Nag');
  23. $mail->isHTML(true);
  24. $mail->Subject = 'Customer Complaint Form';
  25. $mail->Body = $message;
  26. // Attach the uploaded file
  27. $mail->addAttachment($uploadfile,$_FILES['uploaded_file']['name']);
  28. if (!$mail->send()) {
  29. $msg .= "Mailer Error: " . $mail->ErrorInfo;
  30. } else {
  31. $msg .= "Message sent!";
  32. }
  33. } else {
  34. $msg .= 'Failed to move file to ' . $uploadfile;
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement