Results 1 to 4 of 4

Thread: birthday triggered emailing script.

  1. #1
    Join Date
    Oct 2005
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default birthday triggered emailing script.

    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.

  2. #2
    Join Date
    May 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    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.

  3. #3
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    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
    http://roshanbh.com.np/2008/01/how-t...-cron-job.html

    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

    Edit: BEGIN EDIT


    if your ISP supports user-managed cron jobs, and you want to do this in PHP, a general database extraction script is below
    PHP Code:
    $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))
        {
            while(
    mysqli_fetch_array($rs))
            {
                
    mail('TO_EMAIL''HAPPY BIRTHDAY''MESSAGE');
            }
        }

    Edit: END EDIT
    Last edited by boogyman; 05-14-2008 at 04:00 PM.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •