Location: PHPKode > scripts > EasyPhpMassEmail > easyphpmassemail/mass_email_example.php
<?php

/**

EasyPhpMassEmail Example version 0.0.1 - PHP5

Copyright (c) 2011 JF Nutbroek <hide@address.com>
Visit http://www.mywebmymail.com for more information 

Permission to use, copy, modify, and/or distribute this software for any
purpose without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

*/

// The EasyPHPMassEmail classs requires sessions to work
session_start();

// Include the class
include_once('easyphpmassemail.class.php');
$massemail = new easyphpmassemail;

// Our example page
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'. "\n";
echo '<HTML><HEAD><TITLE>EasyPHPMassEmail Class</TITLE></HEAD><BODY>'. "\n";
echo '<div style="padding : 50px 100px 5px 100px;"><strong><p>This is the test page for the EasyPHPMassEmail class.</p></strong></div>'. "\n";

// Check if we have to start a mass email session 
if (isset($_REQUEST['start'])) {

	// Prepare a mass email session
	$massemail -> Emailto             = array('hide@address.com','hide@address.com','hide@address.com','hide@address.com','hide@address.com','hide@address.com','hide@address.com');
	$massemail -> Subject             = 'This is a test';
	$massemail -> Headers             = 'From: hide@address.com\r\nReply-to: $hide@address.com\r'. "\n";		
	$massemail -> Message             = 'This would be the mass email mesage - in any format you like.';
	$massemail -> Batchsize           = 1;
	$massemail -> Testmode            = true;
	$massemail -> Preparemail();
	
	// Start the email queue by opening the queue page in an iframe
	// You can also work without an iframe and start the queue on this page by reloading the entire page after each batch 
	echo '<div style="padding : 5px 100px 5px 100px;"><iframe width="100%" height="500px" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src="mass_email_example_queue.php"></iframe></div>'. "\n";
	
} else {

	// Display a link to start the mass email session
	echo '<div style="padding : 5px 100px 5px 100px;">Click <em><a href="mass_email_example.php?start=1">here<a/></em> to start the mass email.</div>'. "\n";
	
}

echo '</BODY></HTML>'. "\n";

?>
Return current item: EasyPhpMassEmail