Specifications
Sending the Message
Clicking on the Send button for a newsletter activates the send action, which triggers the
following code:
case ‘send’ :
{
send($id, $admin_user);
break;
}
This calls the send() function, which you can find in the mlm_fns.php library. This is quite a
long function. It is also the point at which we use the HTML MIME Mail class.
The code for our function is shown in Listing 28.16.
LISTING 28.16 send() Function from mlm_fns.php—This Function Finally Sends Out a
Newsletter
// create the message from the stored DB entries and files
// send test messages to the administrator, or real messages to the whole list
function send($mailid, $admin_user)
{
if(!check_admin_user($admin_user))
return false;
if(!($info = load_mail_info($mailid)))
{
echo “Cannot load list information for message $mailid”;
return false;
}
$subject = $info[0];
$listid = $info[1];
$status = $info[2];
$sent = $info[3];
$from_name = ‘Pyramid MLM’;
$from_address = ‘return@address’;
$query = “select email from sub_lists where listid = $listid”;
$result = mysql_query($query);
if (!$result)
{
echo $query;
return false;
Building Practical PHP and MySQL Projects
P
ART V
704
34 7842 CH28 3/6/01 3:46 PM Page 704