Welcome to WebmasterWorld Guest from 23.20.12.34

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Mail with Attachment sending twice!

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

Junior Member

joined:Oct 19, 2011
posts: 166
votes: 1


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">';

}else
{


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!";

}

elseif($checkbox=="")
{
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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 12, 2002
posts:857
votes: 0


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)

Junior Member

joined:Oct 19, 2011
posts:166
votes: 1


I actually found the problem; I had two duplicate send lines.
9:31 pm on Feb 6, 2014 (gmt 0)

Senior Member from US 

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

joined:Apr 9, 2011
posts:13210
votes: 347


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