This example shows how to send mail on Linux by calling sendmail in an external stored procedure. It is very primitive and does no error checking as good programming practices should. But it does show how relatively easy it is to get an external stored procedure to do something useful. The procedure can be called from within a trigger action body if desired.
Because the external stored procedure does I/O, the definition includes the EXTERNAL SECURITY clause.