I was using the following mail command in my crontab to which worked flawlessly until we re installed our mail server last Friday:

echo "Testing 123" | mail -s "ECS PostDate Processed" "layton.everson@gmail.com chrish@mycreditcompany.com" -- -r "noreply@mycreditcompany.com" -F "ServerCronJobs"

previously the "--" would rout the command line parameters to sendmail to send from a name and add a reply-to address. Now it seems the -- is being ignored and all of the extra parameters are being treated as email addresses. so the email is going to:

from root <root@mycompany.com>
to me, chrish, -r, noreply, -F, ServerCronJobs

What is missing now?

  • Could you elaborate a bit more on what Ubuntu version you used in the past and which you are using right now? And do you have the old mail server still in reach? Or at least a package list backup? (e.g. something like dpkg --get-selections > mypackages) – gertvdijk May 14 '13 at 21:47
  • Distributor ID: Ubuntu Description: Ubuntu 12.04.1 LTS Release: 12.04 Codename: precise – Layton Everson May 14 '13 at 21:56
  • dpkg --get-selections > mypackages returns no results ... I think it was postfix though. – Layton Everson May 14 '13 at 21:57
  • It has saved the output to mypackages, it should return nothing, all should be in the file. Anyway, you need that from the old server. What version of Ubuntu was the old server running? Same perhaps, but you didn't answer that part. And please edit your question to provide all the new details you gave in these scattered comments. It's not a forum, but a Q&A site, you see? :) – gertvdijk May 14 '13 at 22:17
  • Oh I understand, Its not an old server, I just messed with the mail programs... didn't change servers. – Layton Everson May 14 '13 at 22:20

mail points to one of the alternatives.

ls -l /usr/bin/mail
lrwxrwxrwx 1 root root 22 Jan  5  2011 /usr/bin/mail -> /etc/alternatives/mail

ls -l /etc/alternatives/mail
lrwxrwxrwx 1 root root 18 Jan  5  2011 /etc/alternatives/mail -> /usr/bin/bsd-mailx

You were probably using another mail program in the past. Try to figure out which it was.

After you have installed the right package, then change the alternative like this:

sudo update-alternatives --config mail
| improve this answer | |
  • # ls -l /usr/bin/mail lrwxrwxrwx 1 root root 22 May 13 17:43 /usr/bin/mail -> /etc/alternatives/mail # ls -l /etc/alternatives/mail lrwxrwxrwx 1 root root 23 May 13 17:43 /etc/alternatives/mail -> /usr/bin/mail.mailutils – Layton Everson May 14 '13 at 21:59
  • root@mycreditcompany:/srv/www/homedev.mycreditcompany.com# sudo update-alternatives --config mail update-alternatives: error: no alternatives for mail. – Layton Everson May 14 '13 at 22:19
  • Please point me to a resource about 'adding' mail alternatives? – Layton Everson May 14 '13 at 22:20

As others have noted, it is a link to /etc/alternatives/mail.
you can see that (if you have any package which provides it already installed) by readlink /usr/bin/mail and locate the existing package by readlink -f /usr/bin/mail

It is provided by any package which provides the mail-reader you can search for one with apt-cache search mail-reader personally I use bsd-mailx.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.