1

On my debian server I got exim4 installed. I know, that the MTA works because I can send mails with php and it uses the account configured in /etc/exim4/passwd.client

However when I try on command line

echo "test" | mail -s "test" [email protected]

I get

mail: cannot send message: Process exited with a non-zero status

$? is set to 36

Also /var/log/exim4/mainlog shows no entry just the (successfully) send mails I tried from php and the usual start and end queue run messages, which indicates that the mail command doesn't even reach the MTA.

mail --version

mail (GNU Mailutils) 3.1.1
Copyright (C) 2007-2016 Free Software Foundation, inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

I have searched the web and found issues people had with postfix configuration but since my MTA is exim4 and it works fine on it's own, I wonder what the problem is here.

I have set up two other servers where system mail works fine, I use it in cronjobs. There I also just installed exim4 and configured it accordingly and never had this issue.

3 Answers 3

1

TLDR; might be 32/64 bit issue. Try installing bsd-mailx

I've just encountered the same problem. Up there in the "Used to work, but now it doesn't. I haven't changed anything" category. Rather mystifyingly, nothing appears in any of the logs in /var/log/exim4 when the email fails.

I have a few linux debian machines, some headless, all running Debian Stable. Helpfully I found that running mail on the command line worked on one headless machine, but not on another. This gave me a useful starting point to do a side-by-side comparison with the two setups to see what could be the problem.

Nothing obvious seemed to be different, so in frustration I did an

apt remove --purge exim4*

and re-installed. This had no effect.

To cut a long story short, I looked at the mail binary in /usr/bin/mail, and 'followed' it to /etc/alternatives/mail and found that on the different machines it linked to different mail clients. On the non-functioning machine it linked to:

lrwxrwxrwx 1 root root 23 Aug 23  2017 /etc/alternatives/mail -> /usr/bin/mail.mailutils

but on the working machine it linked to:

lrwxrwxrwx 1 root root 18 Jun 15  2015 /etc/alternatives/mail -> /usr/bin/bsd-mailx

I installed bsd-mailx on the non-working machine, which automatically updated the link in /etc/alternatives, and the problem disappeared. Mail is now working.

Just when I was congratulating myself I had a look at another working machine and noticed that it also linked /etc/alternatives/mail -> /usr/bin/mail.mailutils - so that seemed to blow any theory about it being mailutils.

I had a look at the two installs (sorry couldn't get the formatting):

Non-working machine:

dougie@nick:~$ dpkg -l | grep mailutils 
ii  libmailutils5:i386                    1:3.1.1-1                       i386         GNU Mail abstraction library

ii mailutils 1:3.1.1-1 i386 GNU mailutils utilities for handling mail ii mailutils-common 1:3.1.1-1 all Common files for GNU mailutils

Working machine:

dougie@skye:~$ dpkg -l | grep mailutils
ii  libmailutils5:amd64                     1:3.1.1-1                                       amd64        GNU Mail abstraction library

ii mailutils 1:3.1.1-1 amd64 GNU mailutils utilities for handling mail ii mailutils-common 1:3.1.1-1 all Common files for GNU mailutils

So, it's just a hunch, but perhaps this is related to whether it's a 32 or 64 bit install. And the workaround for me was to install bsd-mailx.

1

Mine is also a 64-bit machine which was giving the error as below

$ echo test | mail -s "testing ssmtp setup" [email protected]
mail: cannot send message: Process exited with a non-zero status

But when I followed @Dougie Nisbet and installed bsd-mailx, it reacted as

$ echo test | mail -s "testing ssmtp setup" [email protected]
send-mail: Authorization failed (534 5.7.14  https://support.google.com/mail/answer/78754 5-v6sm30064941pgc.86 - gsmtp)
Can't send mail: sendmail process failed with error code 1

I know this is not an answer. But as I could not comment on @Dougie Nisbet 's answer, I wrote this here to save others from following the above answer.

0

Please take a look into Postfix error log file, Looks like The email was not sent because Authorization had failed.

Make sure the following, 1. Check Your password ( SMTP authentication password ) 2. Allow less secure apps to access your email account

FYR: https://support.google.com/mail/answer/78754

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .