In my application we have a lengthy script that writes multiple records to a database, copies multiple files from one location on the server to another then sends multiple emails.
Weve noticed that intermittently the process will timeout. After some debugging we noted the timeouts generally occur during sending the mail, we are using PHP mail() and its a hosted Windows server. the host said that the CPU usage seems to spike during this script, would that make sense? I didnt think mail was that intensive?
I was thinking it might be better to queue the mail, we cant get Pear running so cant use mail_queue, but I was thinking we just write the email data to the database then setup a cron/scheduled task to run a script every night to process the first record of the table, after it sends the email it deletes the record, then re-runs itself therefore avoiding timeouts?? Maybe this is a cumbersome solution also.. any feedback would be greatly appreciated.