There is a sample external procedure for Teradata running on UNIX (MPRAS, Linux) for sending email in the user documentation. See “SQL Reference, UDF, UDM, and External Stored Procedure Programming”, release V2R6.1 (and later). See appendix C. This is the prototype:
REPLACE PROCEDURE tdmail( in From_ VARCHAR(100), in To_ VARCHAR(100), in Subject VARCHAR(200), in Message VARCHAR(32000)) LANGUAGE C NO SQL PARAMETER STYLE SQL EXTERNAL name 'CS!tdmail!tdmail.c' EXTERNAL SECURITY DEFINER;
You probably don’t want to set it up as a UDF, because you could end up sending the same email hundreds of times unintentionally, depending on the SQL statement you invoke the UDF in. Remember the database runs SQL in parallel, including UDFs, i.e., many instances at once. Of course if you set it up to send email for different rows for a table it would work, but you would probably make your UNIX system administrator very unhappy because it could overrun their email system very quickly, spam comes to mind.