homepage Welcome to WebmasterWorld Guest from 54.145.172.149
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Mail with Attachment sending twice!
Gilead



 
Msg#: 4643030 posted 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">';

}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!

 

defanjos

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4643030 posted 5:42 pm on Feb 6, 2014 (gmt 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';

Gilead



 
Msg#: 4643030 posted 8:44 pm on Feb 6, 2014 (gmt 0)

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

lucy24

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



 
Msg#: 4643030 posted 9:31 pm on Feb 6, 2014 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved