OK, what this thing a magic does is simple. It gets email ids from a file and sends a newsletter that you've created to all the email ids. Look below for more inf
mailer.php:
<?php
class mailer
{
/*********************************************************************
**
** Class format_num
**
** Author...: leapinglangoor [ leapinglangoor@gmail.com ]
** Date.....: 19 Jan 2005
** Version..: v1.1
**
** Desc.....: This class is used to mail a list which
** is stored in a file. The file format is simple.
** All you have to do is create a file with the
** email id each member in seperate lines. Configure
** the variables below where they are declared.
** Create a newsletter too. Check examples now.
**
**
*********************************************************************/
var $sender = 'Your name'; // Enter your name
var $sender_email = 'admin@yourname.com' // Your email ID
var $headers = 'Content-type: text/html; charset=iso-8859-1\r\n' .
'From: $sender <$sender_email>\r\n'; // A few required headers. Dont modifye
$list = 'list.txt';
$newsletter = 'newsletter.txt';
$subject = 'Newsletter';
$output = 0; // Whether or not to output what it is doing. 1 for yes 0 for no
matthew waygood wrote :1319
You should step through the list of emails. If the file size is quite big, then you are going to have a high memory overhead. You may also want to look at maximum execution time.
Try using file_get_contents() for the newsletter rather than implode("",file($filename)). If its possible your system doesnt have it use:-
if (!function_exists(`file_get_contents`))
{
function file_get_contents($filename, $use_include_path = 0)
{
$file = @fopen($filename, `rb`, $use_include_path);
if ($file)
{
if ($fsize = @filesize($filename))
{
$data = fread($file, $fsize);
}
else
{
while (!feof($file))
{
$data .= fread($file, 1024);
}
}
fclose($file);
}
return $data;
}
}
Things to add maybe:-
Add/remove email address
Validate email address before sending
Option to send many emails via BCC, which would speed it up, but may be rejected by spam filters.