1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

email notification php

Discussion in 'PHP' started by 75dollarseo, Sep 6, 2011.

  1. #1
    hello,

    i am developing a php program for a hostel. i want get a email notification on a special date if anyone don't pay rent. how can i do this on php .. any idea ?

    ----------------------------example -----------------------------

    hostal have 25 rooms.. one person joind hostal on 15th date his room number is 15, so every month 15 th date i want to get a email notification if he not paid rent ...


    any idea ?
     
    Solved! View solution.
    75dollarseo, Sep 6, 2011 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    Please tell us what you already have? are u using a CMS for your hostel? and about the payments? how do you read your payments? by hand?
     
    EricBruggema, Sep 6, 2011 IP
  3. #3
    There's probably 100 different ways to do it and it'll depend on your existing codebase, but to get you going in the right direction...

    - Assuming you have the person stored in a db. You'll have a 'next_payment_due' date.
    - On initially adding the person set this to 1 months time.
    - You'll need a php script which runs daily (cron task) that looks up any people in the db for which the next payment date is less than today.
    - i.e. SELECT * FROM person WHERE next_payment_due < NOW();
    - Loop the results and use the php mail() function to send the email.
    - When a person pays, set their new 'next_payment_due' a month ahead. (well x months ahead based on their original date so the dates keep in sync)

    There's loads of improvements you could make to the above principle however it should get the basics going.
     
    mfscripts, Sep 6, 2011 IP
  4. Domain_Directory

    Domain_Directory Active Member

    Messages:
    256
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #4
    Its pretty simple you should store date in the table and when that date and current date matches you should use mail function of php to send notification to their email address
     
    Domain_Directory, Sep 6, 2011 IP
  5. hotnoob

    hotnoob Member

    Messages:
    96
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    28
    #5
    hotnoob, Sep 6, 2011 IP
  6. 75dollarseo

    75dollarseo Greenhorn

    Messages:
    87
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #6
    Thanks bro
     
    75dollarseo, Sep 7, 2011 IP
  7. freelanceinphp

    freelanceinphp Member

    Messages:
    134
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    48
    #7
    you can setup a cron job and write down email function which runs from tenant date of joining to every 30 days.
     
    freelanceinphp, Sep 7, 2011 IP
  8. dplover147

    dplover147 Member

    Messages:
    120
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    36
    #8
    using cron jobs is the best option.
     
    dplover147, Sep 8, 2011 IP
  9. HungryMinds

    HungryMinds Active Member

    Messages:
    216
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    63
    #9
    Yes Cron Job Is Best For It. Create Your Script And Add It In Your Con Job Settings With Date & Time... Then Your Script Will Be Run Automatically On That Date & Time.
     
    HungryMinds, Sep 13, 2011 IP