Location: PHPKode > scripts > TeamMailer > teammailer/teammailer.php
<?
// Team Mailer was written by Dominic Zschokke, ©2004 artisfaction.com Ltd, Switzerland.
// This script is licensed under the GPL, see the license that comes with this script.
// Using this script for spamming purposes is STRICTLY FORBIDDEN! This is our addition to the GPL.
// Violation of this additional condition or even the intention of violating it,
// cancels your right to use, modify or distribute this script.
// Enjoy this script and please let me know how happy you are with it: hide@address.com

include "config.php";

// DO NOT EDIT BELOW THIS LINE
//------------------------------------------------------------------------------------

$subject = $_POST[subj];
$anrede = $_POST[hoi];
$ebody = stripslashes($_POST[ta]);
$from = $_POST[mali];
$error = "";
$lines = array();

if($ebody == ""){$error.="Error: Your message can't be empty!<br>";}
if($subject == ""){$error.="Error: The subject can't be empty!<br>";}
if($from == ""){$error.="Error: Who are you? Choose your user name from the list!<br>";}

if($error == ""){
	if(file_exists($list)){
		$fp = fopen("$list","r");
		
		//read the file into an array
		while(!feof($fp)){
			$line = fgets($fp,4096);
			array_push($lines,$line);
		}
		fclose($fp);
				
		$outs = array();
		$ins = array();
		
		//first pass, evaluate sender, fill in- and out-array	
		foreach($lines as $data){
			if($data != "" && $data != "\n"){
				$elem = explode(";",$data);
				$id = $elem[0];
				$id_name = "uid_"."$id";
				$name = $elem[1];
				$email = $elem[2];
				$email = str_replace("\n","",$email);
				$email = str_replace("\r\n","",$email);
				if($from == $email){
					$sender = $name;
				}
				if($_POST[$id_name] != NULL && $_POST[$id_name] == $id){
					array_push($ins,$email);
				}
				else{
					array_push($outs,$email);
				}
			}
		}
		
		$to_all_ins = implode(", ",$ins);
		
		//second pass, mail, output
		foreach($lines as $data_nxt){
			if($data_nxt != "" && $data_nxt != "\n"){
				$elem = explode(";",$data_nxt);
				$name = $elem[1];
				$email = $elem[2];
				$email = str_replace("\n","",$email);					
				if(in_array($email,$ins)){
					$msg = "Team mailing sent by $sender to:\n$to_all_ins\n**********************************\n";
					$msg.= "$anrede $name,\n\n";
					$msg.= $ebody;
					$msg.= $sig;
					$msg = str_replace("\r\n","\n",$msg);
					mail("$email","$subject","$msg","From: $from");
					echo"SUCCESSFULLY sent to $name: $email<br>";
				}
				else{
					echo"NOT sent to $name: $email<br>";
				}
			}
		}
				
		echo"<br>&nbsp;<br><a href=\"javascript:window.close()\">CLOSE THIS WINDOW NOW!</a><br>OR JUST DON'T RELOAD IT! Visit <a href=\"http://www.google.com\">GOOGLE</a> for example.";
		
		//admin notification
		if(!in_array("$admin_email",$ins)){
			$adm_msg = "$sender has sent a team message without including the admin to:\n";
			$adm_msg.="$to_all_ins\n";
			$adm_msg.="The message is:\n";
			$adm_msg.="$ebody";
			$adm_msg = str_replace("\r\n","\n",$adm_msg);
			$subject.=" <Admin Notification>";
			mail("$admin_email","$subject","$adm_msg","From: $from");
		}
		
		//receipt to the sender if unchecked
		if(!in_array("$from",$ins)){
			$title = "Confirmation of your team mailing: ";
			$sub_reset = $_POST[subj];
			$title.="$sub_reset";
			$mbm_msg = "You, $sender, sent this message to the following team members:\n";
			$mbm_msg.="$to_all_ins\n";
			$mbm_msg.="Your Message was:\n";
			$mbm_msg.="$ebody";
			$mbm_msg.="\n\nWARNING: If you didn't send a team mail and if you receive this message, an unknown team member sent this message using your name. Please report this incident to the administrator: $admin_email\n";
			$mbm_msg.="Team Mailer: $location";
			$mbm_msg = str_replace("\r\n","\n",$mbm_msg);
			mail("$from","$title","$mbm_msg","From: $admin_email");
		}

	}
	else{
		echo"file could not be found";
	}
}
else{
	$error.="<a href=\"javascript:history.back(1)\">Back</a>";
	echo"$error";
}

?> 
Return current item: TeamMailer