Reputation: 77
Let me try to explain to you what i need:
the user creates a post on the site and choose which users can have access to this post. When the user submits the information, each person chosen to have access to post receives an email warning. To perform this I use ajax through jquery. The problem is that this process may be too long until all the emails have been sent.
So I thought the process would work as follows:
1rst - Save the post;
2snd - Save the information of emails (subject, recipient, etc.) in a database table;
3th - run a php file in "parallel" to fetch the information of emails and send them - with the goal of not having to wait for it to execute.
Is the third step possible?
I hope i explain me well :)
Thank you all.
Upvotes: 1
Views: 141
Reputation: 433
If you have access to the server crontab, simply setup a new crontab to run every minute and execute the mail sending. This way it's not related to your workflow, so you can store the emails somehow in files or database, etc.etc., and send out later from a different script.
crontab -e -u (webserver user)
Upvotes: 1