Linux Classes
Linux Training
* Linux Classes *

LINUX CLASSES - EMAIL

How Do I Send Email With Linux?

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 hermie

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 hermie@fritz.com since in this case, this is equivalent to hermie.

Previous Lesson: Perl Pattern Matching
Next Lesson: Reading Email

[ RETURN TO INDEX ]

Comments (most recent first)

AmarJ     (10 Aug 2010, 12:26)
Is it possible to send a message to a local systems,which are connected by LAN through a sambaserver in linux.............?
Hemant     (09 Jul 2010, 05:58)
Hello Abhijit,

you use this steps,
1) ssh IP Address
2)system ask you password. you write that system password and use command......init 6.
MUKTI     (24 Jun 2010, 07:16)
My mail sending is always failed can anyone help me out for this..... plz
jnlickey     (04 Jun 2010, 07:55)
@martinjester - thank you, now it is working!
martinjester     (03 Jun 2010, 16:40)
jnlickey,

you need to do install mailutils on Ubuntu, then it will work correctly

sudo apt-get install mailutils
jnlickey     (03 Jun 2010, 15:30)
I tried this in ubuntu 9.10 and it errors out stating that the mail program is not installed.

hermie@ubuntu:~$ mail <name of user>
The program 'mail' can be found in the following packages:
* heirloom-mailx
* mailutils
Ask your administrator to install one of them
mail: command not found
hermie@ubuntu:~$
sejweka herbert     (02 Jun 2010, 00:12)
Dr. I have tried the mail command on solaris but it has not worked.
Do you known the mail command that I can use on the above operating system?
Recently at my faculty, a group of programmer who had customized ubuntu into there own version visited us and showed us there version.
I would like known how they got to access the O/S's code and which tools did they use?
Abhijit     (01 May 2010, 15:32)
How to restart Linux servers remotely
mohan kumar     (09 Mar 2010, 10:05)
good document

*Name:
Email:
Notify me about new comments on this page
Hide my email
*Text:
 

Ask Bob Rankin - Free Tech Support
<Send This Link to a Friend>         <Bookmark This Page>


Copyright © by Bob Rankin
All rights reserved - Redistribution is allowed only with permission.