You can implement the queue manually using MySQL or some other persistent mechanism, but you can also use JMS to queue. It is quite suitable for such situations.
In this case, I will be tempted if you separate the mail component from the main application and let the two communicate using JMS. The main application places the message in the JMS, and the mail application will subscribe to the queue and try to process the messages.
JMS can be simplified (e.g. MySQL) using configuration.
The advantage of splitting Webapp is that you abstract from the notification mechanism and can implement it in the future, for example. Google Wave or IRC or something else without touching the main application.
Someone suggested using postfix or sendmail and letting them handle the order. This is also a great solution, especially if you put a postfix or sendmail on localhost and let it route messages further. Try setting up this mail program to allow only mail routing from the local host to prevent the creation of an open mail client :)
EDIT clarified the use of JMS + comment on local mail daemon
extraneon
source share