deftx Posted March 25, 2009 Share Posted March 25, 2009 For some odd reason, the mail() function is sending out duplicate e-mails. This only occurs in this script. I have confirmed that the mail function is only being called once. Code snippet: db_query("UPDATE ads_$table SET status='1' WHERE adID='$adID'"); if ($row['fos'] != "") { $fos = "\r\nDegree Category: " . $row['fos'] . "\r\r"; } $body = template1("../templates/ad_approved.txt",array('adID' => $adID, 'adType' => ucfirst($table), 'title' => $row['title'],'line1' => $row['line1'], 'line2' => $row['line2'], 'dispurl' => $row['d$ if ($_REQUEST['mailsent'] != 1) { mail($row['username'],"CWC AnywhereAds - Ad Approved",$body,"From: $NOREPLY_EMAIL\r\nReply-To: $AD_SUPPORT_EMAIL\r\n"); $_REQUEST['mailsent'] = 1; } The template1 function only replaces %%variable%% with the actual value. The $_REQUEST['mailsent'] was an attempt to make sure the mail wasn't sent twice, but it still failed. I'm at a loss. Any help is appreciated. Thanks! Rob Vella Link to comment https://forums.phpfreaks.com/topic/151023-duplicate-emails-using-mail/ Share on other sites More sharing options...
Yesideez Posted March 25, 2009 Share Posted March 25, 2009 Try this and tell me what the output is between the *s... if ($_REQUEST['mailsent'] != 1) { echo '*'.$row['username'].'*'; mail($row['username'],"CWC AnywhereAds - Ad Approved",$body,"From: $NOREPLY_EMAIL\r\nReply-To: $AD_SUPPORT_EMAIL\r\n"); $_REQUEST['mailsent'] = 1; } Link to comment https://forums.phpfreaks.com/topic/151023-duplicate-emails-using-mail/#findComment-793400 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.