Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

PHP Script for Anonymous Emailing.


ghost's Avatar
0 0

I found this PHP script a while ago, but it doesn't seem to work on my own free web server. I was wondering if someone could help determine what's flawed or help me make a new one. I'm not great with PHP, but I know the basics and I have good references. (In this script, there is also protection against bombing, but that's not what I'm concerned about.)

// (c) Sean G
// (c) Sean G

$from=$_POST['from'];
$headers = "From:<$from> \r\n";
$headers = "X-Sender: <$from>\r\n";
$headers = "MIME-Version: 1.0\r\n";
$to=$_POST['to'];
$subject=$_POST['subject'];
$body=$_POST['body'];
$loops=$_POST['loops'];
$proc = "false";
$proccount = 0;
$protect = "false";
$x = 0;

$protection[0] = "adminaddress1@domain.com";      
$protection[1] = "adminaddress2@domain.com";
$protection[2] = "adminaddress3@domain.com";
$protection[3] = "adminaddress4@domain.com";
// Set protection so that if any1 tries to bomb you, they'll get the same in return
// If you want more admin emails, look at the pattern... add $protection[4] = "";  for example

while ($proc == "false")
{
	if ($protection[$x] == "")
		$proc = "true";   // exit loop

	if ($protection[$x] == $to)
	{
		$protect = "true";   // ahh ha!
		$proc = "true";       // exit loop
	}
	$x++;
}

if ($protect == "true")
	protect($loops, $from, $protection, $subject, $body);
else
{

if ($from == "")
{
	$from = "blank";
}
else
{
	if ($to == "")
	{
		$to = "blank";
	}
	else
	{
		if ($loops == "")
		{
			$loops = "blank";
			error($loops,$to,$from);
		}
		else
		{
			sucess($loops,$to,$subject,$body,$headers,$from);
		}
	}
}
}

function sucess($loops,$to,$subject,$body,$headers,$from)
{
	for($x = 0; $x <= $loops; $x++)
	{
		mail($to,$subject,$body,$headers,$from);
	}
	print("$loops emails have been sucessfully sent to $to  mueheheeee");
}

function error($loops,$to,$from)
{
	if (($from == "blank") || ($loops == "blank") || ($to == "blank"))
	{
		print("Please make sure you fill in all required fields!");
	}
}

function protect($loops, $from, $protection, $subject, $body)
{
	for($x = 0; $x <= $loops; $x++)
	{
		mail($from,$subject,$body,"From: $protection");
	}
	print("You are you bombing me?? Tell you what, ill reverse the process a little :D\n $loops emails have been sent to $from");
	
}


?>```

Here is the HTML document that goes along with it.

```markup<form action="http://[my site]/email.php" method="POST">
From: <input type="text" name="from" value="" size="40"><br>
To: <input type="text" name="to" value="" size="40"><br>
Subject: <input type="text" name="subject" value="" size="60"><br>
Body: <textarea wrap="virtual" rows="10" name="body" cols="50"></textarea><br>
Loops: <input type="text" name="loops" value="0" length="5"><br>
<input type="submit" value="Send!">
</form>
<br><br><br>

Mr_Cheese's Avatar
0 1

even though are discussing this over AIM, i'll just post so others understand.

the error you have is most likely caused by you not having a SMTP server installed. SO once you have setup FreeSMTP, let me know if it works or not and i'll help a bit more.


ghost's Avatar
0 0

I said free web server, not domain :p

As in one that I am running on my computer just to host my PHP scripts. It has PHP 5 installed. Mr_Cheese is right, the problem is to do with my SMTP server but I can't solve it :(

Here is the error message: > Warning: mail() [function.mail]: SMTP server response: 550 Invalid recipient: slimtim10@hotmail.com in C:\server\email.php on line 72

Fatal error: Maximum execution time of 30 seconds exceeded in C:\server\email.php on line 73

Line 72: mail($to,$subject,$body,$headers,$from);

But like Mr_Cheese said, the problem is to do with my SMTP server, not the script.


Mr_Cheese's Avatar
0 1

SlimTim10 wrote: Fatal error: Maximum execution time of 30 seconds exceeded in C:\server\email.php on line 73 .[/quote]

to fix this put,

set_time_out(0);

at the top of your script. It wont make any difference to this script, but for others it might be useful ;)

/edit - dam grind got there before me in posting it!!


ghost's Avatar
0 0

Well, the good news is that the script doesn't timeout now. The bad news is that the same error message still exists:

Warning: mail() [function.mail]: SMTP server response: 550 Invalid recipient: slimtim10@hotmail.com in C:\server\email.php on line 74


ghost's Avatar
0 0

Thanks, but I'd rather have my own and edit it to my liking. Using someone else's script is kind of.. script kiddie-ish. Also, it can be tracked to khs-calw.de which, if people visit the website, they would know it was the script.


Mr_Cheese's Avatar
0 1

have you tried the script with all your firewalls turned off?


ghost's Avatar
0 0

Yep, I only use the Windows Firewall but I turned it off.