I haven't paid much attention to the discussions of SPI, but I remember seeing questions about the server-side system tasks in the trigger context, among which sending mail was the most frequent. I am not aware whether such questions were sufficiently answered in the lists, so when I had to write my first ever trigger yesterday, I felt like I was on my own with the system tasks (although the triggers and plpgsql are explained very well in the docs). So, here's my take on e-mail: http://wit.mcs.anl.gov/~selkovjr/pg_extensions/contrib.tgz (see the README in mail/) I believe it should be trivial to do other tasks in a similar way, using sockets and rsh. At least, it is better to do it that way than fork the backend. --Gene
