mail -s "unix-asg1" firstname.lastname@example.org < 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 email@example.com 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" firstname.lastname@example.org