With regards an OMS, what is the best method to send a confirmation email? The 2 options I have so far are;
- A script on the order page sends an email once the record is written to the database.
- A scheduled task on the server, send the email, polling the database every-so-often to find new entries.
Which method do systems currently use?
This is a question of scalability. Sending a confirmation email once the record is written to the database is the least scalable. The more orders that are taken , the more emails are sent potentially tying up resources.
A scheduled task is certainly better as emails can be queued up and can be sent in a separate process.
A further option which you could consider is using neither and delegating the responsibility of sending emails to a 3rd party dedicated emailing service, i.e. via an API. This is much better since your hosting does not have to consider the load and you can utilise any reporting offered by the 3rd party. Plus many services offer a free quota up to a certain threshold. This will allow you OMS and business to scale appropriately.