The most basic way to send email on a Linux system is with the mail command. The mail program is a command-line interface for sending and receiving electronic mail. It works, but it's not pretty. Later in this section, you'll learn about Pine, a much friendlier email interface, but you should know how to use mail since it's guaranteed to be available on any Unix system. Let's say you're logged in as root and you want to send a message to hermie. Start the process by typing
mail username@gmail.com
The system will respond with a Subject: prompt. Type the subject for your note, press enter, and then write your message, line by line. When you're done with your missive, press enter to get to a blank line, then ctrl-D to send it.
Here's a sample mail session. (The stuff you type is shown in bold, and the system prompts are normal intensity.)
# mail hermie
Subject: Gone Fishing
I've decided to kick back this afternoon and go fishing.
So if this crazy Linux system rolls over and dies,
I suggest you do likewise.
^D
EOT
After you press ctrl-D, the system responds with the cryptic EOT message, which could mean "End of Text," or "Eat Only Twinkies," or whatever you like.
You may notice an apparent contradiction in the preceding example, since the email address of the recipient does not contain an @ sign and a domain name. If the sender and recipient are on the same system, it's all right to give just the user name as the email address. You could just as well have addressed your mail to username@gmail.com since in this case, this is equivalent to username.
NOTS:
you need to do install mailutils on Ubuntu, then it will work correctly
sudo apt-get install mailutils
No comments:
Post a Comment