samoht Posted April 30, 2011 Share Posted April 30, 2011 Hello all, I have a website that uses Joomla 1.5 as a CMS - that is designed for users to register and download a software. The users are generally not that tech savy and need a reminder or some help via email. I have it set up that users need to activate there account after registration - and the activation code is sent to them via email. Now I need to send a follow up “Thank You” email 1 day after people have authenticated themselves and another email 1 week later with a basic survey regarding satisfaction so far. I have looked up all the ready built extensions for Joomla and have not been able to find anything. Can someone help me understand what would need to be done to accomplish this? I'm guessing I'll need to loop through the database looking for users that have registered between 36 and 24 hours prior - and have activated their accounts (This may be a problem though if they wait more than 2 days to activate their accounts?) then send an email to the user and update some new field in the database with another time stamp for sending this email. Then loop through the db again looking for the second time stamp being older than 1 week and send another email?? Thanks for any help, Quote Link to comment https://forums.phpfreaks.com/topic/235186-how-to-send-a-follow-up-email-1-week-after-reg/ Share on other sites More sharing options...
PaulRyan Posted April 30, 2011 Share Posted April 30, 2011 How about adding another fieldname in your DB called activation_time and then put a timestamp in there when they activate their account. Then to send a follow-up e-mail a day later you can loop through the DB like the following: $dayAgo = (time()-(60*60*24)) $myQuery = "SELECT email,name FROM users WHERE activated = 'No' AND activation_time < $dayAgo"; if($doQuery = mysql_query($myQuery)) { if(mysql_num_rows($doQuery)) { while($row = mysql_fetch_assoc($doQuery)) { // Send Email code Here } } else { echo 'No e-mails need to sent.'; } } else { echo 'This query failed: "'.$myQuery.'"'; } The do something similar for the week follow-up, but change the $dayAgo calculation to $dayAgo = (time()-(60*60*24*7)) This is a solution that will work, but there maybe better ones out there. Regards, PaulRyan. Quote Link to comment https://forums.phpfreaks.com/topic/235186-how-to-send-a-follow-up-email-1-week-after-reg/#findComment-1208822 Share on other sites More sharing options...
ignace Posted May 1, 2011 Share Posted May 1, 2011 We need some database information here, like do you have a field like PaulRyan suggests? One that keeps record on when they registered and when they activated? If you have then you can select all users like: "Now I need to send a follow up “Thank You” email 1 day after people have authenticated themselves" SELECT * FROM users WHERE activated_on = CURRENT_DATE - INTERVAL 1 DAY ".. and another email 1 week later with a basic survey regarding satisfaction so far." SELECT * FROM users WHERE activated_on = CURRENT_DATE - INTERVAL 1 WEEK @PaulRyan SELECT email,name FROM users WHERE activated = 'No' AND activation_time < $dayAgo That will select everyone with activated = 'No' regardless whether that was yesterday or last year. Quote Link to comment https://forums.phpfreaks.com/topic/235186-how-to-send-a-follow-up-email-1-week-after-reg/#findComment-1208989 Share on other sites More sharing options...
PaulRyan Posted May 1, 2011 Share Posted May 1, 2011 Well spotted ignace, it was late here :/ I did a brain fart. Quote Link to comment https://forums.phpfreaks.com/topic/235186-how-to-send-a-follow-up-email-1-week-after-reg/#findComment-1209012 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.