Linux Classes
Share This With a Friend  
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 [email protected] 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
(Please feel free to answer questions posted by others!)

Michael     (25 Dec 2013, 15:28)
I like the tutorials but the "Return to Index" does not seem to work.
pqkdfhg     (20 Oct 2013, 21:19)
Ламинин.Факты-упрямая вещь. Вы можете не верить,
но это правда. Практически ВСЕ болезни,даже неизлечимые,уходят благодаря Ламинину.
Этим не шутят. Себе дороже.
Распространение по МЛМ. Денег здесь много.
Реально, но в данном случае вторично.
Здоровье важнее.
Проверить легко.
Просто уделите 2 минуты.
Поставка Ламинина в страны СНГ.
Диетическая Добавка. Сертифицировано в Украине.
Цена 300 гривен и ниже в МЛМ.
скайп evg7773
OpensVpns     (31 Jul 2013, 02:04)
Hello My Dear Friends, Users Forum !

The Company In-Disguise . Com

Anonymous Internet Surfing, Anonymous Downloading-Uploading Torrent-P2P, Amonymous WiFI.
In-Disguise . Com - Fully Automatic and Anonymous VPN Service , you don’t have to waste time on:

1 - Search Supports if disconnected from a server, search for a standard installation “OpenVPN client”
spend time for installing downloaded configs to the program.
Subscribe to All Servers of Our Service for 9 Euro; 3 months = 20 Euro; 6 months = 35 Euro; 1 year = 55 Euro.

2 - Unique “VPN Client” is easy to install on all kinds of Operating Systems: MAC / Windows / Linux!!!
Will allow you to switch easily between the VPN servers in USA / DE / UK / IT / NL / LU / EG / PA / RO / MY Continuing
Types of VPN connections included in a single subscription - DoubleVPN and OpenVPN.

3 - Company Takes All Kinds Of Payments in Full Auto Mode!
WebMoney / Visa / Master Card / PayPal / Liberty Reserve / BitCoin / SMS and many others.

Our VPN Service Is Here!

in-disguise . com

ICQ: 6906911

Sincerely, Your Anonymous VPN Service : In-Disguise . Com
Acupmume     (02 Jun 2013, 15:19)
My consultant was so
euphonious, polite, and ensured that I got
precisely what I wanted. She couldn't have been more
benevolent during a laborious time.
My advisor was so
enjoyable, polite, and ensured that I got
in all respects what I wanted. She couldn't experience been more
sympathetic during a problematical time.
Aronaenfown     (27 May 2013, 18:24)
A manor house is a grand habitation, especially a peer royalty habitation or the residency of a administrator of governmental or some other high-ranking dignitary, such as a bishop or archbishop.<>] The intelligence itself is derived from the Latin name Palatium, proper for Palatine Hill, one of the seven hills in Rome

A palace is a luxurious abode, predominantly a royal stay or the make clear of a headmaster of state or some other high-ranking superstar, such as a bishop or archbishop.<>] The in short itself is derived from the Latin name Palatium, for Palatine Hill, solitary of the seven hills in Rome

A castle is a respected abode, predominantly a royal stay or the home of a head of voice or some other high-ranking dignitary, such as a bishop or archbishop.<>] The in short itself is derived from the Latin rank Palatium, proper for Palatine Hill, solitary of the seven hills in Rome

A palatial home is a grand castle, noticeably a viscountess residence or the diggings of a administrator of state or some other high-ranking lady muck, such as a bishop or archbishop.<>] The intelligence itself is derived from the Latin big cheese Palatium, fit Palatine Hill, a woman of the seven hills in Rome

A manor house is a luxurious residence, predominantly a peer royalty chƒteau or the diggings of a administrator of state or some other high-ranking superstar, such as a bishop or archbishop.<>] The in short itself is derived from the Latin superstar Palatium, fit Palatine Hill, a woman of the seven hills in Rome

A manor house is a luxurious habitation, noticeably a viscountess chƒteau or the diggings of a headmaster of state or some other high-ranking superstar, such as a bishop or archbishop.<>] The intelligence itself is derived from the Latin superstar Palatium, looking for Palatine Hill, bromide of the seven hills in Rome
vakusapp     (11 Mar 2013, 10:05)
Здравствуйте
Возникла проблема,не могу писать посты на форуме, часто выдает
ошибку FlashScript 458 Error
Что это может быть ?
AvafesyAreree     (01 Mar 2013, 01:22)
Продаю реганные аккаунты: Редиректы Dot.tk , Gmail.com AE PVA , Zero Catch , Yahoo.com , Liveinternet.ru , Pinterest.com , Vkontakte.ru SMS Plus , Bitly.com API и многое другое в наличии и на заказ.

- очень большой ассортимент + различные аккаунты активированные по смс

<b>По всем вопросам пишите сразу в аську ICQ 231538</b>







акуанты yahoo , купить акк жж , продажа аккаунтов youtube , продажа аккаунтов mail.ru , mamba распрадажа , интернет магазин аккаунтов drjynfrnt , покупка аккаунта на мамбе , купить аккаунты вконтакте , продажа аккаунты вконтакте , продажа аккаунтов facebook , продажа аккаунтов вконтакте , аккаунт xml , магазин аккаунтов лавпланет , база акков майл ру , продам аккаунты одноклассники , купить аккаунты gmail , где купить аккаунты gmail , купить аккаунт твиттер с фолловерами , продам дневник site:liveinternet.ru , yahoo.co.ru , продажа аккаунтов facebook , купить аккаунт linkedin , купить аккаунты вконтакте , купить gmail аккаунты , приходят ли смс от loveplanet , купить акки соц сетей , магазин онлайн продажи аккаунтов mamba , liveinternet.ru/users/akkayntu/ , продажа аккаунтов yahoo , продам акки вк , продажа аккаунтов вконтакте , одноклассники акки , купить аккаунты вконтакте , аккаунты одноклассников , продам аккаунт одноклассники , магазин аккаунтов вконтакте , купить аккаунт email , продажа аккаунтов: yahoo gmail , продажа аккаунтов vkontakte , купить красивые аккаунт яндекс , онлайн магазин аккаунтов вконтакте , купить аккаунты вконтакте онлайн , онлайн сервис аккаунтов вконтакте , куипть акки mail.ru , купить аккаунты facebook.com , цены на аккаунты одноклассников , www.yandex.ru дневник , продажа аккаунтов odnoklassniki , user.prodaja gmail.com , продам акки мамба , покупка аккаунтов в контакте , продажа акков livejournal , купить аккаунты вконтакте онлайн , продам раскрученные акки вконтакте , онлайн магазин аккаунтов , купить аккаунты mail.ru , vkontakte.ru codi , знакомства майл ру как узнать реалстатус , куплю аккаунты мамба со статусом реал , город друзья комментарии yahoo hotmail , продаем аккаунты одноклассников , аккаунты яху , магазин аккаунтов , продажа акков вк , real-статус мамба в формате , купить аккаунты яндекс , куплю mail.com акки , магазин аккаунтов , купить аккаунты mail.ru авторег , магазин аккаунтов youtube , онлайн продажа аккаунтов вконтакте , купить facebook pva , 1 google продажа , купить аккаунты вконтакте онлайн , аккаунты yahoo pop3 .
Sruthi     (16 Mar 2012, 06:56)
Hi, I am trying to send a mail through mail command in linux but not able to. Here is the command I am giving.
mail -s "Sub:Test Mail" [email protected]
When I give this command, its geting struck and nothing is coming later. Mine is Red Hat Linux 5.3 (Tikanga). But I am able to send the mails from the application server with my EmailService.

I even tried the mutt utility. Here is the below command I used.

mutt -a test.out -s "Sub-Test" [email protected]

Please do the needful.

Thanks
RAM     (04 Mar 2012, 22:09)
Hi This is ram. In my office we are using linux imap email server. Recently i created a new user email account. After that email working internally fine. But External email unable to receive and cannot sent. Previous user all emails working fine.. Recently created emails only problem... I need to know the wat is the problem.. Can anybody give suggesstion...
james ward     (05 Feb 2012, 17:11)
I hope that this will teach me a little
thank you
Majed     (21 Jan 2012, 06:46)
are you getting sender unknown in the log messages?
Embedded Demon     (22 Dec 2011, 13:17)
Unable to receive mail after,

[root@localhost ~]#mail -s "test" [email protected]
text..
Cntrl-D

Can somebody help me get out of this trouble...?
Majed     (07 Dec 2011, 08:18)
mail -v email address
is more useful as a command as it shows whether the mail was sent or not before checking the log files.
lakshmi     (05 Nov 2011, 23:42)
how the program is running automatically on the remote host and how can i get that results automatically to my system .......how can i write all these commands in one .sh script program?
Simon Ochana     (05 Nov 2011, 12:15)
Rico
I use a Red Hat derivative
Try editing the file or its equivalent "/etc/xinetd.d/telnet"

# default: on
# description: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}










rico     (19 Sep 2011, 00:39)
here again, now i can run a telnet server and an ssh server. ssh works great, i can login, remote copy, and remote execution of programs. telnet works only if the telnet client is on the same computer as the telnet server...but when i try to connect from a remote computer which is the what we want a telnet to work...it said "Connection refused". can somebody try to help me on this.
thanks
rico     (06 Sep 2011, 00:09)
sir,

first, i want to thank you for setting up this linux tutorial, i learned a lot from this and it proves to be a great
reference. actually it was in this site where i started to study linux. using linux is quite addicting, that i
started to download lot of tutorials, and managed to learned more from them.

my issue is about running a telnet server. the distro that i'm using right now is ubuntu 10.10. it does not include
the package that is required for running telnet daemon. installing additional package is not easy since my computerat
at home is not connected to the internet, "apt-get install [package]" is not possible. my option is to use dpkg
command to install package from a file. i already downloaded the package "inetutils-telnetd*.deb" and all its
dependencies and manage to successfully install it. but i cant seem to run telnetd, even if i issue the command to
run it. "ps" command does not show that it is running although inetutils-inetd is running which is one of its
dependency. i've search all the tutorials i have but cant find the topic, although i havent search the HOWTO doc.
man pages doesnt help me neither. i dont know if i need to make a script to run the telnet daemon and put it in
the runlevel directory. my linux default runlevel is 2, and i saw a script inside the rc2.d directory which runs
the inetutils-inetd automatically at startup.

i can seldom access the internet, so searching thoroughly the solution from the web is quite not possible.
hope you'll have the time to give me a solution.

also, can i ask how to share a directory to the network using the command line. and how can i mount and access
it from another linux machine. i know ftp is one solution, but i also cant run ftpd after installing it.

thanks in advance.

rico

Nittin Kumar     (29 Apr 2011, 07:45)
Hi i want to make a shell script in which my daily log files directly send to my email address from my unix server.Please help me!!Thanks Nittin
Vineet Mittal     (27 Apr 2011, 05:49)
How can i send email with one by one email sending option, like (automailsender for windows),
Please suggest software name if any yet for linux.
Bob Rankin     (26 Apr 2011, 10:13)
@pavelvolinkiinss - There is no malware on this site. You are seeing a false positive from your security software.
pavelvolinkiinss     (26 Apr 2011, 03:18)
Admin, hello! here are having problems with your site. malware warning Write me. icq 989567856647
changlizzie     (21 Apr 2011, 07:40)
how can i create mail server using linux?
Shilpa     (22 Mar 2011, 23:34)
I am running Oracle jobs on Linux, how can i trigger mail to a person, on the failure of job. Your response will help me a lot....Thank you.
MPC     (04 Feb 2011, 00:23)
How to uninstall .exe files in linux ubuntu 9.04
ROBO(Speed-1-TeraHz....Mem-1-Zetabyte)     (20 Jan 2011, 10:36)
how to install ssh in linux.........
GANAPATHI     (20 Jan 2011, 10:25)
Sir....
How to send message threw terminal in linux
jim     (28 Dec 2010, 19:07)
This is very useful. please remove some of the extraneous details, it's full of fun facts@
anup     (17 Nov 2010, 02:28)
I want to send mail from my system to another system both in linux and same LAN. i have tried with mutt,mail,mailx but after everything i got the message that
No mail for XXXX
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

I welcome your comments. However... I am puzzled by many people who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn all you can, ask questions if you like. But don't ask me to send what you already have. :-)

NO SPAM! If you post garbage, it will be deleted, and you will be banned.
*Name:
Email:
Notify me about new comments on this page
Hide my email
*Text:
 
 


Ask Bob Rankin - Free Tech Support


Copyright © by - Privacy Policy
All rights reserved - Redistribution is allowed only with permission.