mail -s "unix-asg1" email@example.com < apple.txt
This is very useful if you are a Unix shell and you don't want to enter your mail program.
Note: this may not work on all Unix systems. If this doesn't work, follow this example to mail a file's contents.
You can use the echo command to send a short text message in one line. Say you want to send the message "City Hall 1pm" to firstname.lastname@example.org with the subject line "meeting today" by email. You can do it at the Unix prompt like this:
echo "City Hall 1pm" | mail -s "meeting today" email@example.com