Log in

View Full Version : Resolved Have You Forgotten Us?



M2com
08-14-2011, 09:31 PM
I've been trying to create a PHP script that sends an email to a user who hasn't visited our site in a while. How can I do this?

Thanks!

traq
08-14-2011, 09:43 PM
do you currently log when users visit?

your flow might look like:

--check db for users with "last_visit" more than {whatever interval you choose} ago
--use mail() (http://www.php.net/manual/en/book.mail.php) to send reminder

you could possibly make this a cron job, so it would run automatically at a set interval.

honestly, though, I would recommend against this.
People who don't visit your website anymore won't be happy to get annoying reminders about it.
for example, I'm getting mighty p*ssed at linkedin right now.

M2com
08-14-2011, 10:15 PM
LOL!

What would be an example of "last_visit" and "more than {whatever interval you choose} ago"? Sorry but I'm a little new in this area of PHP.

Thanks!

traq
08-15-2011, 01:24 AM
well, that's directly related to if you already keep a record of when users visit your site (presumably in a database). Do you currently do this?