How to get recorded calls emailed to the users mailbox?

Hi.

I have enabled the automon feature (*1), which works.
It leaves the recorded messages in /var/spool/asterisk/monitor where they can be picked up by the web gui.

What I want is to have those recorded messages sent to the e-mail account associated with the extension who recorded the conversation.

I’ve written a shell-script to do this. The problem is I can’t get asterisk to run the script.
I tried putting it in macro-hangupcall as a System() call, but that did not work.