Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // read the list of emails from the file.
- $email_list = file("elist.txt");
- // count how many emails there are.
- $total_emails = count($email_list);
- // go through the list and trim off the newline character.
- for ($counter=0; $counter<$total_emails; $counter++) {
- $email_list[$counter] = trim($email_list[$counter]);
- }
- // implode the list into a single variable, put commas in, apply as $to value.
- $to = implode(",",$email_list);
- $subject = "TEST";
- $message = "TEST";
- $headers = 'From: TEST <TEST@gmail.com>' . "rn";
- if ( mail($to,$subject,$message,$headers) ) {
- echo "The email has been sent!";
- } else {
- echo "The email has failed!";
- }
- ?>
- $subject = "TEST";
- $message = "<html><body><p>Text</p></body></html>";
- $headers = 'From: TEST <TEST@gmail.com>' . "rn";
- // To send HTML mail, the Content-type header must be set
- $headers .= 'MIME-Version: 1.0' . "rn";
- $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
- $html = <<<MSG
- <html>
- <head>
- ....
- </head>
- <body>
- <h2> text title </h2>
- <span>$variable</span>
- ....
- </body>
- </html>
- MSG;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement