To send mail on system "cgi", do the following:
This will open the "file" MAIL as a pipe that you can write to. The data that you write to MAIL will be the body of the message.open( MAIL, " | /usr/bin/mail -s \'$s\' $a" );
$s
will be the subject at the top of the message.
$a
will be the destination of the message.
When I do:
/usr/bin/mail -s 'Test Message' ltaber@lt.tucson.az.us < mailtest
The file mailtest had the content of:
This is a test message. I am sending it to me. - Louis
I get this appended to my mail file (/var/spool/mail/ltaber):
From ltaber Tue Nov 3 08:22:02 1999 Return-Path: $<$ltaber$>$ Received: by lt.tucson.az.us id m0zaiHS-000a5dC (Debian Smail-3.2 1996-Jul-4 #2); Tue, 3 Nov 1999 08:22:02 -0700 (MST) Message-Id: <m0zaiHS-000a5dC@lt.tucson.az.us> Date: Tue, 3 Nov 1999 08:22:02 -0700 (MST) From: ltaber (Louis Taber) To: ltaber@lt.tucson.az.us Subject: Test Message Status: O X-Status: This is a test message. I am sending it to me. - Louis