how to use send mail when an event occurs
Moderator: General Moderators
- itsmani1
- Forum Regular
- Posts: 791
- Joined: Mon Sep 29, 2003 2:26 am
- Location: Islamabad Pakistan
- Contact:
how to use send mail when an event occurs
i want to use send mail function of php on some event like new year etc. (i want to send email on 1st jan how to do that) i have problem in mail funciton and its use but how to intigrate it with time/event.
- itsmani1
- Forum Regular
- Posts: 791
- Joined: Mon Sep 29, 2003 2:26 am
- Location: Islamabad Pakistan
- Contact:
are you sure in this way i will be able to handel my alerts. actually my requirements are:
some one add or delete on the system, now what i want is : if the alert is present on the system and its time of execuation has come it has to be executed and i did not found any thing available in php for tht till now.
some one add or delete on the system, now what i want is : if the alert is present on the system and its time of execuation has come it has to be executed and i did not found any thing available in php for tht till now.
to make it simple, like Tim said, use crontab. Have your alert script executed once a day. It searches on database for event.. Each event has date entered into the database. If the date matched with today's date -> send email.itsmani1 wrote:... i did not found any thing available in php for tht till now.
If you are advanced, instead of running the script everyday and search the whole table on datbase looking for today's event, you can write script to add to crontab for every single event. PHP only cannot write to cronjob log if it does not allow to use shell command, but you can use PHP and include cgi using virtual function. The rest on how to write to the log - I don't know how