views:

61

answers:

3

Hi,

I am working on a site where I have the admin manager and i am trying to see how can I allow the admin to send mass emails to notify the event he is organizing, once he invites for the first time then towards during the event date, cron job should automatically send reminder to the author the email id's he used first time. something like how evite does. would like to learn these functionalities and also if possible how to send email if the event is canceled or postponed.

regards

A: 

I would look into the PHP Mail functions. They also have solid examples and more can be found online as well. Use something server side to keep track of dates for when to run the scripts

Josh K
+2  A: 

One way to do this would be to have an OutgoingEmail table, and in that table store the date/time that the email should go out, the email address, subject, and body.

When the event is organized, generate the contents of the email and insert a record for each attendee with the current date/time. If the admin selects for a reminder to go out, also insert those emails with that future date/time. When the event changes, clear out any pending outgoing email records for that event, and insert records for an 'event changed' email (and if necessary, add new reminder emails with the updated details.)

Create your PHP script that will run from the crontab, and have it query any records in the OutgoingEmail table with date/times in the past. Loop through them using the PHP mail() function and delete them as you send them successfully.

Schedule it to run every 10 minutes or so, and you should code a routine to ensure that only one instance is running at a time. In the past I have created a 'lock' file, and the start of the script would check for the lock file. If the lock file exists, quit. If it does not exist, create it, process emails, and then remove the lock file.

Do you have more questions?

Fosco
thanks, i couldn't work on this yet, i will post more notes/accept answers once i am done.
Jay
A: 

I would use this class for sending emails, i have used for years and is very tidy.

http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/

then run a query on the table say where the date is in 14 days time and send an email with that class. Make sure you highlight the table rows with a reminder sent just in case that file gets run again before the next day, people will get really annoyed if they get more than one reminder.

Wright-Geek
hi, sorry to post this question after a gap. as i mentioned in other coment, I haven't had chance to work on this. Can you please show me some examples in doing this? This is my situation, i am going to show 'send email" next to each event in the admin manager. when clicked i am planning to show an email form, send it to viewers and store that email id's, event name date in a table. i am struck after this, how i should send auto remainders. i am assuming your idea of using this class would help, can you please thro more light on how to use this?
Jay