Advertisement
Guest User

Untitled

a guest
Sep 19th, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['submit'])){
  3. $name = $_FILES["file"]["name"];
  4. $tmp_name = $_FILES['file']['tmp_name'];
  5. $error = $_FILES['file']['error'];
  6. if (isset ($name)) {
  7. if (!empty($name)) {
  8. $location = 'C:/inetpub/wwwroot/';
  9. if (move_uploaded_file($tmp_name, $location.$name)){
  10. $lines = file ($location.$name);
  11. foreach ($lines as $name){
  12. $tos = array('$name', '$name','$name');
  13. $from=$_POST ['from'];
  14. $subject=$_POST ['subject'];
  15. $message=$_POST ['message'];
  16. foreach ($tos as $to){
  17. $ok = mail ($tos, $subject, $message, "From:".$from);
  18. }
  19. if ($ok) {
  20. echo "Message Send";
  21. } else {
  22. echo "Error";
  23. }
  24. }
  25. echo 'Uploaded';
  26. }
  27. } else {
  28. echo 'please choose a file';
  29. }
  30. }
  31. }
  32. ?>
  33. <form action="" method="post" enctype="multipart/form-data">
  34. <input type="file" name="file">
  35. <br>
  36. <p>Your Email Address: <input type="text" name="from" size="30"><br /></p>
  37. <p>Subject: <input type="text" name="subject" size="30"<br /></p>
  38. <p>Message:<br /></p>
  39. <p><textarea rows="10" name="message" cols="30"></textarea><br /></p>
  40. <input type="submit" name="submit" value="send message">
  41. </form>
  42.  
  43. <input type="text" name="subject" size="30"<br /> should be
  44. <input type="text" name="subject" size="30" /><br />
  45.  
  46. foreach ($tos as $to){
  47. //change this line
  48. $ok = mail ($tos, $subject, $message, "From:".$from);
  49. //to this
  50. $ok = mail ($to, $subject, $message, "From:".$from);
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement