Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-18-2015, 11:17 PM   #1
Registered: Aug 2015
Posts: 211

Rep: Reputation: Disabled
Why can't send mail with command mail or mailx?

I have installed postfix and start postfix service .
I can send email from user root to user debian8 by telnet command.

root@pengsir:/home/debian8# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 pengsir.hfi ESMTP Postfix (Debian/GNU)
ehlo mail
250-SIZE 10240000
250 DSN
mail from:<root>
250 2.1.0 Ok
rcpt to:<debian8>
250 2.1.5 Ok
354 End data with <CR><LF>.<CR><LF>
this is a test mail send from root
250 2.0.0 Ok: queued as CA53CF82C3
221 2.0.0 Bye
Connection closed by foreign host.

Let's change user debian8 to receive the email.

root@pengsir:/home/debian8# su debian8
debian8@pengsir:~$ mail
Mail version 8.1.2 01/15/2001. Type ? for help.
"/var/mail/debian8": 1 messages 1 new 1 unread
N 1 root@pengsir.hfi Wed Aug 19 10:10 13/441
& 1
Message 1:
From root@pengsir.hfi Wed Aug 19 10:10:56 2015
X-Original-To: debian8
Date: Wed, 19 Aug 2015 10:10:23 +0800 (HKT)
From: root@pengsir.hfi

this is a test mail send from root

& quit

It is strange that i can not send email with `mail` or `mailx` command.

mail -s 'test_for_postfix' debian8@pengsir.hfi
mailx -s 'test_for_postfix' debian8@pengsir.hfi

It look like that the cursor will be stop in the console forever ,no error info putput when to execute the two commands.
Old 08-19-2015, 04:28 AM   #2
Registered: Aug 2015
Posts: 211

Original Poster
Rep: Reputation: Disabled
I got the answer :

input something (it will be content of the email),press ctrl +d ,input something for cc , press enter.
Old 08-19-2015, 11:10 AM   #3
LQ 5k Club
Registered: Jan 2011
Location: Nowhere near you, thank God.
Distribution: OSX Sierra
Posts: 8,591
Blog Entries: 15

Rep: Reputation: Disabled
sudo -c mail -s LQRocks root < /dev/null
mail: Null message body; hope that's ok
jj@my-kungfu ~ $ sudo su -
my-kungfu ~ # mail 
"/var/mail/root": 1 message 1 new
>N   1 jj                 Wed Aug 19 11:07  12/388   LQRocks
as root, try
mail -s LQRocks debian8 < /dev/null
telnet, why?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to send mail form within my python script via mailx and sendmail NikosGr Linux - Newbie 2 09-06-2013 04:14 AM
[SOLVED] How to send a mail in HTML format using mailx or mail or sendmail commands vishnu_knl Linux - Newbie 8 04-05-2012 11:00 AM
Debian etch - Unable to send mail from command line or from php mail command lqforumuser Linux - Newbie 1 03-01-2009 07:56 AM
can mail command be used to send mail onto global mail servers like yahoo etc dale_chip Linux - Newbie 4 08-12-2008 09:33 AM
command line email client to send mail to remote mail server dhanju Linux - Software 1 03-07-2008 07:37 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:58 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration