balkan7 Posted July 4, 2008 Share Posted July 4, 2008 How can i limit send to mail once, if i got on site more guests or members send many messages, i wanna to send just once. code is: // send msg 1 week before expire $now = time(); $week = $now+(60*60*24*7); $nextweek = date("Y-m-d H:i:s", $week); if ($data['expire'] <= $nextweek && $data['expire'] >=$now) { $to = $user_email; $from = "From:". $locale['M_EMAIL']; $msg = $locale['M_110'].$user_name."\n\n".$locale['M_111']; $subject = "Hello from ".$locale['M_SITE']; mail($to,$subject,$msg,$from); } Quote Link to comment https://forums.phpfreaks.com/topic/113245-send-once/ Share on other sites More sharing options...
fanfavorite Posted July 4, 2008 Share Posted July 4, 2008 I assume this is all in a database, so I would just have another field called EmailExpire or whatever and have it set to Yes if email is sent and then add && $data['EmailExpire'] == "No" Quote Link to comment https://forums.phpfreaks.com/topic/113245-send-once/#findComment-581796 Share on other sites More sharing options...
balkan7 Posted July 4, 2008 Author Share Posted July 4, 2008 how can i limit whitout another field in datebase ? because this code is located on main page and just check time when guest open the page, if i have 5 guests send 5 msg on mail Quote Link to comment https://forums.phpfreaks.com/topic/113245-send-once/#findComment-581799 Share on other sites More sharing options...
fanfavorite Posted July 4, 2008 Share Posted July 4, 2008 From what I understand is that you want to send an expiry notice to members only once and this script runs everytime someone visits the site correct? You will have to store somewhere (database, txt file, etc) data that says whether an email has been sent to that user for expiration or not. Easiest way is what I suggest above. Quote Link to comment https://forums.phpfreaks.com/topic/113245-send-once/#findComment-581802 Share on other sites More sharing options...
balkan7 Posted July 4, 2008 Author Share Posted July 4, 2008 Runs everyone who visited site, yes stored on datebase. This is for ads system just send mail to one member who got ads on site, so i need to limit send to mail notice once. Quote Link to comment https://forums.phpfreaks.com/topic/113245-send-once/#findComment-581810 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.