I need Help with Advance PHP FORM function

Hello,
PLEASE i want to know how to code form to send mail to the emails from the Attached File… I have this as sample please help…


 $headers  = "From: My site<noreply@example.com>\\r\
"; 
 $headers .= "Reply-To: info@example.com\\r\
"; 
 $headers .= "Return-Path: info@example.com\\r\
"; 
 $headers .= "X-Mailer: PHP v".phpversion().$eol; 
 $headers .= 'MIME-Version: 1.0' . "\
"; 
 $headers .= "X-Priority: 1 (Highest)\
";
 $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\\r\
"; 
 $headers .= 'To: Mary <mary@example.com>' . "\\r\
";
 $headers .= 'Bcc: birthdaycheck@example.com' . "\\r\
"; /* I want to have more BCC email, the email are save in a text.. Please how can I include it.. thank */
$subject = 'About My site';
$message = "<html> 
  <body bgcolor=\\"#DCEEFC\\"> 
    <center> 
        <b>  Lol!!! I am reciving HTML email......</b> <br> 
        <font color=\\"red\\">Thanks Mohammed!</font> <br> 
        <a target=_blank  href= "www.maaking.com">maaking.com</a> 
    </center> 
      <br><br>*** Now you Can send HTML Email <br> Regards<br>MOhammed Ahmed - Palestine 
  </body> 
</html>"; 

mail ($headers, $message, $subject);
header ('location: thank.html');
exit();


Thanks


$file = file_get_contents("test.txt");

$pattern = "/([a-z0-9\\+_\\-]+)(\\.[a-z0-9\\+_\\-]+)*@([a-z0-9\\-]+\\.)+[a-z]{2,6}/ix";

preg_match_all($pattern, $file, $matches);


// multiple recipients
$to = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = ' 
<html> 
<head> 
  <title>Birthday Reminders for August</title> 
</head> 
<body> 
  <p>Here are the birthdays upcoming in August!</p> 
  <table> 
    <tr> 
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th> 
    </tr> 
    <tr> 
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td> 
    </tr> 
    <tr> 
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td> 
    </tr> 
  </table> 
</body> 
</html> 
';

// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\\r\
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\\r\
";

// Additional headers
$headers .= 'To: Mary <mary@example.com>' . "\\r\
";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\\r\
";
$headers .= 'Cc: birthdayarchive@example.com' . "\\r\
";
$headers .= 'Bcc: ' . implode(",", $matches[0]) . "\\r\
";

// Mail it
mail($to, $subject, $message, $headers);

and the txt file:


test@example.com test2@example.com, test3@example.com
test4@example.com  test5@gmail.com


Thank so much for your Reply… Please I will like to know how to include the the (File.txt ) into the File… Can it be attached??? Thanks

the test.txt is just an example, you can change it.


// change test.txt to FIle.txt or something else
// file_get_contents — Reads entire file into a string
$file = file_get_contents("test.txt");