CSN wrote:
>>Why cant your application handle this?
>>Otoh, why dont you provide a function to send mail,
>>which takes some parameters and just let your users
>>use them? No need for everybody to write her own
>>mail function.
>
>
> Convenience! I want the email sent whether the member
> is added via the web interface, directly in the
> database, from the command line, etc. I don't see any
> downside. It's only one user that'll be using this
> function.
But it does mean that user is running code as the database user, so if
you don't trust them with that, don't do it.
What I use with this is a "message_queue" table and a cron-job that runs
once a minute (or every 5). It keeps the two processes separate (decide
to send a message and assemble the message and send it) and also lets
you get more complicated (in one example I need to build a report,
produce a PDF and then attach it to the email I generate).
--
Richard Huxton
Archonet Ltd