How to stop script and send email

Hi everyone.
I wrote a simple script Bro that print a log file after read event from broccoli. I would like that the script stop automatically at the end and not with ctrl-c on keyboard. Is there a way for this?
And another simple question: how send email with bro?