I am using Linux...and when I try to send a mail (mail username) it gives me error:
/usr/sbin/sendmail: no such file or directory


sendmail is not installed on the machine? when I ls /usr/sbin I can see sendmail.sendmail


Any suggestion,
Data Sheet Linux

Dani AI

Generated

Brief diagnosis and practical steps to fix the "/usr/sbin/sendmail: no such file or directory" error reported by . The usual causes are: no mail transport agent (MTA) installed, the system provides a different MTA binary, or the sendmail wrapper link is missing. The steps below show how to identify your distro, find any installed MTA, and either enable the correct sendmail wrapper or install one.

Find the distribution (so you know which package manager to use):

cat /etc/os-release
lsb_release -a
uname -a

Locate any sendmail binary or running MTA and find package ownership:

which sendmail
type -a sendmail
ls -l /usr/sbin/sendmail*
readlink -f /usr/sbin/sendmail
ps aux | egrep 'postfix|exim|sendmail' | grep -v grep

# package that owns the file:
dpkg -S /usr/sbin/sendmail    # Debian/Ubuntu
rpm -qf /usr/sbin/sendmail    # RHEL/CentOS/Fedora

If an MTA is installed but /usr/sbin/sendmail is missing, prefer using the alternatives system rather than a manual symlink:

sudo update-alternatives --config mta    # Debian/Ubuntu
sudo alternatives --config mta           # RHEL/Fedora/CentOS

Only create a manual symlink if you know the target is a real sendmail-compatible binary and executable:

sudo ln -s /usr/sbin/sendmail.sendmail /usr/sbin/sendmail

(Use this as a last resort and make it executable if needed.)

To install a simple, local MTA (examples; pick the one appropriate for the distro found above):

sudo apt update && sudo apt install postfix
sudo yum install postfix
sudo dnf install postfix

Then enable/start it:

sudo systemctl enable --now postfix

Test delivery:

echo "Subject: test" | sendmail -v your@address

For background on choices and configuration, see Debian's MTA overview and Postfix documentation: Debian MailTransportAgent and Postfix. Mentioning prior replies: and were right to ask which distro — that determines the exact package/commands — and 's point about alternative MTAs is relevant because many distributions provide a sendmail-compatible wrapper via the alternatives system.

Recommended Answers

All 8 Replies

What distribution are you using?

How to find out this?

Data Sheet Linux

You don't know what distribution you're using? Please tell me you didn't install Linux yourself.

many new linuxes come with exim or even postfix these days

So what distro are you using? And in my opinion installing exim and postfix by default seems like the definition of bloat.

debian comes with exim now. rh/fedora are still sendmail I think

i know that on redhat/ fedora you can choose eithner sendmail or postfix

aaaaaaand postfix is a much better choice, IMO.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.