Okay found one more bug with this. If a robot hits the page it will send out a blank email to all users by triggering the mail action. To solve this you could a) attempt to block all robots and hope a user never try's the address or b) user this code below. This is the whole code not just the part I added however if you do just want those lines its 22-27.
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
// Simple Mailing List//
//CODE COMPILED BY CHRIS MACDONALD http://www.christophermacdonald.net //
$message = $_POST['message'];
$myfile = "addresses.txt";
$fh = fopen($myfile, 'r');
$thedata = fread($fh, 20000000);
fclose($fh);
$to = '';
$subject = 'Subject test';
$headers = 'MIME-Version: 1.0' . "\r\n";
$header .= "From: youremailaddressgoeshere@yourdomain.com" . "\r\n";
$header .= $thedata . "\r\n";
if ($message == "") {
die ("Please go back and enter your message</body></html>");
}
else {
mail($to, $subject, $message, $header);
}
echo 'Mail Sent';
?>
</body>
</html>
Bookmarks