Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Mail with Attachment sending twice!



4:44 pm on Feb 6, 2014 (gmt 0)

Can anyone tell me why this script might send the mail out twice?

if (@mail($recipient, $subject, $message, $headers))

echo "Thank You! We will Contact You When We Have An Opportunity Requiring Your Skills-<br />";
echo"You will be redirected back to the employment page in 10 seconds...";
echo'<meta http-equiv="refresh" content="10;url=employment2.php">';


echo"<h1>Error ! Unable to send Mail..</h1>";


It does work, but it sends the same mail twice.

Prior to this, I do have some security:

$loadtime = $_POST['loadtime'];
$checkbox = $_POST['antispam'];
$robotest = $_POST['robotest'];
$totaltime = time() - $loadtime;

if($totaltime < 7) {
echo("Please fill in the form before submitting!");
echo'<meta http-equiv="refresh" content="5;url=employment2.php">';

elseif($robotest != "" && $checkbox = " ")
echo "Please refrain from SPAMMING!";


echo $checkbox;
echo"Go back and click on the check box please.";
echo'<meta http-equiv="refresh" content="10;url=employment2.php">';

else {

Too many nested else statements?
Thanks for any help!


5:42 pm on Feb 6, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Tough to tell without seeing the whole code.

But, what do you have for $recipient, could the email be repeated here?

i.e. $recipient = 'email@example.com, email@example.com';


8:44 pm on Feb 6, 2014 (gmt 0)

I actually found the problem; I had two duplicate send lines.


9:31 pm on Feb 6, 2014 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

... and that's why Technical Support asks if the computer is plugged in :)