Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['submit'])){
- $name = $_FILES["file"]["name"];
- $tmp_name = $_FILES['file']['tmp_name'];
- $error = $_FILES['file']['error'];
- if (isset ($name)) {
- if (!empty($name)) {
- $location = 'C:/inetpub/wwwroot/';
- if (move_uploaded_file($tmp_name, $location.$name)){
- $lines = file ($location.$name);
- foreach ($lines as $name){
- $tos = array('$name', '$name','$name');
- $from=$_POST ['from'];
- $subject=$_POST ['subject'];
- $message=$_POST ['message'];
- foreach ($tos as $to){
- $ok = mail ($tos, $subject, $message, "From:".$from);
- }
- if ($ok) {
- echo "Message Send";
- } else {
- echo "Error";
- }
- }
- echo 'Uploaded';
- }
- } else {
- echo 'please choose a file';
- }
- }
- }
- ?>
- <form action="" method="post" enctype="multipart/form-data">
- <input type="file" name="file">
- <br>
- <p>Your Email Address: <input type="text" name="from" size="30"><br /></p>
- <p>Subject: <input type="text" name="subject" size="30"<br /></p>
- <p>Message:<br /></p>
- <p><textarea rows="10" name="message" cols="30"></textarea><br /></p>
- <input type="submit" name="submit" value="send message">
- </form>
- <input type="text" name="subject" size="30"<br /> should be
- <input type="text" name="subject" size="30" /><br />
- foreach ($tos as $to){
- //change this line
- $ok = mail ($tos, $subject, $message, "From:".$from);
- //to this
- $ok = mail ($to, $subject, $message, "From:".$from);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement