Jump to content

Duplicate emails using mail()


deftx

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.