- Get every email addresses the mailing should go to.
- Foreach email addresses send the mail
Asynchronous calls
To avoid this bad behaviour, a method called asynchronous call can be used. The principle is the following : insead of doing the whole action during the response, the action is put into a queue and is performed by another process which is independant of the client's request, process call "daemon".
The daemon will then look at the queue to check if there is some action to take, and do them until the queue is empty. When the queue is empty, it will wait until some new job come into the queue.
Asychronous calls are then implemented with two parts :
- A queue which will contain the jobs to do
- A daemon which will do the jobs in the queue.