This is not hard, you have many choices
# 1 - Configure local email server to send an email via ISP SMTP server and write normal shell scrip to router all mail using mail command. This is easiest and works with everything.
# 2 - Use special smtp mail client such as
Software :: SendEmail - Send email with this free command line email client
mailsend - send mail via SMTP Protocol
Google for other software
# 3 - use perl / php to send email
php example
PHP Send Email Using Authenticated SMTP Mail Server In Real Time
Perl code
Sending mail with Perl mail script