-bash: sendmail: command not found

July 30, 2014 21.8k views

I installed sendmail:

$ sudo apt-get install sendmail
Reading package lists… Done
Building dependency tree       
Reading state information… Done
The following extra packages will be installed:
  procmail sensible-mda
Suggested packages:
  sendmail-doc rmail
The following NEW packages will be installed:
  procmail sendmail sensible-mda
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 587 kB of archives.
After this operation, 805 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirrors.digitalocean.com/debian/ wheezy/main procmail i386 3.22-20 [154 kB]
Get:2 http://mirrors.digitalocean.com/debian/ wheezy/main sensible-mda i386 8.14.4-4 [218 kB]
Get:3 http://mirrors.digitalocean.com/debian/ wheezy/main sendmail all 8.14.4-4 [215 kB]
Fetched 587 kB in 0s (779 kB/s)
Selecting previously unselected package procmail.
(Reading database … 30414 files and directories currently installed.)
Unpacking procmail (from …/procmail_3.22-20_i386.deb) …
Selecting previously unselected package sensible-mda.
Unpacking sensible-mda (from …/sensible-mda_8.14.4-4_i386.deb) …
Selecting previously unselected package sendmail.
Unpacking sendmail (from …/sendmail_8.14.4-4_all.deb) …
Processing triggers for man-db …
Setting up procmail (3.22-20) …
Setting up sensible-mda (8.14.4-4) …
Setting up sendmail (8.14.4-4) …

But when I type “sendmail” it says the command isn’t found. Did I install sendmail properly? If I did, why is it saying the command isn’t found?

2 Answers

That’s how I’ve installed it!

When I type the command which sendmail I get the following /usr/sbin/sendmail

What do you get if you write the command sudo find / -name "sendmail"

  • When I entered which sendmail it returned /usr/sbin/sendmail for me as well.

    And when I entered sudo find / -name "sendmail":

    # sudo find / -name "sendmail"

    PHP’s mail function seems to be working now so I guess sendmail is installed and working properly.


Somewhat confusingly, the sendmail package doesn’t actually provide the /usr/sbin/sendmail command.

# apt-file search /usr/sbin/sendmail
citadel-mta: /usr/sbin/sendmail
courier-mta: /usr/sbin/sendmail
esmtp-run: /usr/sbin/sendmail
exim4-daemon-heavy: /usr/sbin/sendmail
exim4-daemon-light: /usr/sbin/sendmail
lsb-invalid-mta: /usr/sbin/sendmail
masqmail: /usr/sbin/sendmail
msmtp-mta: /usr/sbin/sendmail
nullmailer: /usr/sbin/sendmail
postfix: /usr/sbin/sendmail
qmail-run: /usr/sbin/sendmail
sendmail-base: /usr/sbin/sendmailconfig
ssmtp: /usr/sbin/sendmail
xmail: /usr/sbin/sendmail
  • Oh ok. Those other commands don’t work for me either though (including apt-file).

    But PHP’s mail function seems to be working now so I guess sendmail is installed and working properly.


Have another answer? Share your knowledge.