LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 10-23-2015, 03:46 AM   #1
sleftar
Member
 
Registered: Sep 2015
Posts: 50

Rep: Reputation: Disabled
Mail Command Failure driving me crazy


Hi. I am looking how to use mail command, found some pages and tried to install mailutils and after that used the option, no configuration..

sudo apt-get install mailutils

whatever i did, ended up with a failure message such as:

Code:
ginger@multilayer:~$ mail -s "hello world" mygmail@gmail.com < letter.txt
mail: cannot send message: Process exited with a non-zero status
Is it due to my firewall settings? It is like this.

Quote:
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip

To Action From
-- ------ ----
22 ALLOW IN Anywhere
21/tcp ALLOW IN Anywhere
10999 ALLOW IN Anywhere
11001 ALLOW IN Anywhere
22 (v6) ALLOW IN Anywhere (v6)
21/tcp (v6) ALLOW IN Anywhere (v6)
10999 (v6) ALLOW IN Anywhere (v6)
11001 (v6) ALLOW IN Anywhere (v6)
Any help would be appreciated..

Last edited by sleftar; 10-23-2015 at 04:29 AM.
 
Old 10-23-2015, 04:20 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
mail (aka mailx) is just the end user util; it actually needs an MTA ie mail server SW eg sendmail, postfix etc) to send mail via.

What distro & version have you got? Do you have an MTA service installed; iif so check the logs or try eg /var/log/messages.
You could also try re-running with the '-v' option to get more info.
 
Old 10-23-2015, 04:28 AM   #3
sleftar
Member
 
Registered: Sep 2015
Posts: 50

Original Poster
Rep: Reputation: Disabled
ubuntu 14 server edition. I only installed mailutils.

http://www.binarytides.com/linux-mail-command-examples/

used this page and some others but did not work

Last edited by sleftar; 10-23-2015 at 04:29 AM.
 
Old 10-23-2015, 04:36 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Like I said, you need an MTA aka mail server service.
According to a quick google, it looks like it would be postfix, so install it
Code:
sudo apt-get install postfix
I don't know if the default install will let you send emails; it probably will, but you need to google it eg log file locations etc.
 
Old 10-23-2015, 04:39 AM   #5
sleftar
Member
 
Registered: Sep 2015
Posts: 50

Original Poster
Rep: Reputation: Disabled
yeah i know, i also installed postfix.. gives same error

Quote:
ginger@multilayer:~$ mail -s "hello world" mygmail@gmail.com < letter.txt
mail: cannot send message: Process exited with a non-zero status
 
Old 10-23-2015, 04:56 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Like I said, use the -v switch AND check all the logfiles - check with google for the exact log to look at.
For postfix its likely /var/log/maillog
 
1 members found this post helpful.
Old 10-23-2015, 05:01 AM   #7
sleftar
Member
 
Registered: Sep 2015
Posts: 50

Original Poster
Rep: Reputation: Disabled
I dont think i really understand what i should do
what is -v switch?
there is no such a file /var/log/mailllog

Quote:
gingercook@DSTmultilayer:~$ cat var/log/maillog
cat: var/log/maillog: No such file or directory

Last edited by sleftar; 10-23-2015 at 05:03 AM.
 
Old 10-23-2015, 05:11 AM   #8
sleftar
Member
 
Registered: Sep 2015
Posts: 50

Original Poster
Rep: Reputation: Disabled
http://jafty.com/blog/tag/use-linux-...ils-from-shell
This link says log file is inside

/var/spool/mail/root

there is a path like
/var/spool/mail
but inside this directory there is no such a file named root or ec2-user.. Inside this directory is empty.

Last edited by sleftar; 10-23-2015 at 05:14 AM.
 
Old 10-23-2015, 06:52 AM   #9
sleftar
Member
 
Registered: Sep 2015
Posts: 50

Original Poster
Rep: Reputation: Disabled
Alright. I found the log file for this problem
It is inside the /var/log/mail.err

here is the log file

Quote:
Oct 23 02:05:32 DSTmultilayer postfix/sendmail[15605]: fatal: open /etc/postfix/main.cf: No such file or directory
Oct 23 02:58:34 DSTmultilayer postfix/sendmail[18817]: fatal: open /etc/postfix/main.cf: No such file or directory
Oct 23 03:02:29 DSTmultilayer postfix/sendmail[19057]: fatal: open /etc/postfix/main.cf: No such file or directory
Oct 23 03:08:45 DSTmultilayer sSMTP[19898]: Unable to locate mail
Oct 23 03:08:45 DSTmultilayer sSMTP[19898]: Cannot open mail:25
Oct 23 03:26:31 DSTmultilayer sSMTP[20969]: Unable to locate mail
Oct 23 03:26:31 DSTmultilayer sSMTP[20969]: Cannot open mail:25
Oct 23 03:29:37 DSTmultilayer sSMTP[21163]: Unable to locate mail
Oct 23 03:29:37 DSTmultilayer sSMTP[21163]: Cannot open mail:25
Oct 23 03:39:48 DSTmultilayer postfix/sendmail[22400]: fatal: open /etc/postfix/main.cf: No such file or directory
Oct 23 03:56:53 DSTmultilayer sSMTP[24021]: Authorization failed (534 5.7.14 https://support.google.com/mail/answer/78754 200sm6945666qhh.26 - gsmtp)
Oct 23 03:57:10 DSTmultilayer sSMTP[24045]: Authorization failed (534 5.7.14 https://support.google.com/mail/answer/78754 g77sm6997496qgd.5 - gsmtp)
Oct 23 04:36:03 DSTmultilayer postfix/sendmail[27194]: fatal: open /etc/postfix/main.cf: No such file or directory
Oct 23 04:36:30 DSTmultilayer postfix/sendmail[27620]: fatal: open /etc/postfix/main.cf: No such file or directory
Oct 23 04:38:46 DSTmultilayer postfix/sendmail[27755]: fatal: open /etc/postfix/main.cf: No such file or directory
Oct 23 05:06:05 DSTmultilayer postfix/sendmail[29345]: fatal: open /etc/postfix/main.cf: No such file or directory
Oct 23 05:08:22 DSTmultilayer postfix/sendmail[29479]: fatal: open /etc/postfix/main.cf: No such file or directory
Oct 23 06:48:44 DSTmultilayer postfix/sendmail[2976]: fatal: open /etc/postfix/main.cf: No such file or directory
 
Old 10-23-2015, 07:08 AM   #10
Tonus
Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-current with grub2
Posts: 385
Blog Entries: 3

Rep: Reputation: 97
Mail Command Failure driving me crazy

Looks like you're missing the config file

Have a look here :
http://www.postfix.org/BASIC_CONFIGURATION_README.html
 
1 members found this post helpful.
Old 10-23-2015, 09:15 AM   #11
sleftar
Member
 
Registered: Sep 2015
Posts: 50

Original Poster
Rep: Reputation: Disabled
seriously why it is missing? Should be there by default. And do I have to manually add all of these things? No other solution for this problem?
 
Old 10-23-2015, 09:23 AM   #12
sleftar
Member
 
Registered: Sep 2015
Posts: 50

Original Poster
Rep: Reputation: Disabled
ALright i just created an empty main.cf file and restarted postfix. It worked for some reason even though the main.cf is empty... Sends mails to my gmail but gmail thinks those are spam...

Last edited by sleftar; 10-23-2015 at 09:28 AM.
 
Old 10-23-2015, 10:37 AM   #13
Tonus
Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-current with grub2
Posts: 385
Blog Entries: 3

Rep: Reputation: 97
Mail Command Failure driving me crazy

That might be fixed by adding yourself in some kind of white list or in Gmail address book I think...
 
1 members found this post helpful.
Old 10-23-2015, 11:01 AM   #14
sleftar
Member
 
Registered: Sep 2015
Posts: 50

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Tonus View Post
That might be fixed by adding yourself in some kind of white list or in Gmail address book I think...
Thanks for the help :3
 
  


Reply


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
New mail server now up and running but certificates are driving me crazy!! fusion1275 Linux - Software 9 02-17-2011 06:20 AM
Driving me crazy!!! fusion1275 Programming 3 10-15-2008 06:19 PM
JACK driving me crazy... pujolasdf Linux - Software 6 05-18-2005 03:50 PM
[ ] @ are driving me crazy FireInTheDark Linux - Software 1 11-28-2004 10:42 AM
Help this is driving me crazy!!!!!! Wolfy Linux - Hardware 1 07-07-2004 02:32 AM


All times are GMT -5. The time now is 11:00 AM.

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