View Full Version : birthday triggered emailing script.
01-14-2007, 09:30 AM
Hi, I am looking for any script (java, cgi, or php) that would be able to parse through a flat file .txt database. It will be able to read the birthdate field of the database and send an email (email address in email field) the the record corresponding to the person with that birthday.
I am trying to do is make a little birthday database containing people I know with birthdates and emails. Everyday, the script will automatically parse through the database when if a birthday comes up, it will send out an email saying happy birthday or etc...
Thank you so much.
05-14-2008, 02:17 PM
I know this is an old thread, but I need something like this as well.
One of my clients is a restaurant and I'd like to use it for their Birthday Club. A visitor signs up to the birthday club and then on their birthday, or even better would be a configurable number of days before (like a week), a coupon is e-mailed to them.
I'm guessing that php with a mysql database would be the practical choice, but then again I'm just guessing.
I've been searching for a while for this (maybe not looking in the right places) and am quite surprised that I haven't found anything.
05-14-2008, 03:53 PM
you would need to write a cron job, to check every day at a certain point.
first contact your ISP (host) to see if they allow user cron jobs, and if they do take a look at
then you would need to create that file to in the first instance read a flat file, in the second instance, check the database.... and send some type of pre-formatted email
if your ISP supports user-managed cron jobs, and you want to do this in PHP, a general database extraction script is below
$link = mysqli_connect('HOST','USERNAME','PASSWORD','DATABASE');
if($link && mysqli_select_db('DATABASE', $link))
$grabBday = "SELECT _bday_fields_ FROM _bday_table_ WHERE _bday_check_ = '_bday_check_value'";
if($rs = mysqli_query($link, $grabBday))
mail('TO_EMAIL', 'HAPPY BIRTHDAY', 'MESSAGE');
05-14-2008, 09:54 PM
You don't really need a cron job--
it's possible to also run this on the index page of your site (check if it has been run that day-- if not, run it and save that it has been run), though that can be a bit more work for the server. Or, of course, just manually go to the page, but that's a pain.
Cron jobs are good if they work, but can be hard to get setup sometimes.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.