How do I email from kdb?

I would like to email whenever the value of a variable is -1 . how do i go about emailing?
Could you please help. I would like to set the subject of the email to "Error: " .

why not just use command line mail from kdb? e.g.

system"mail -s "Error: foobar\ myself@me.com"

(if you’re unix)