Error: Could not execute mail delivery program '/usr/sbin/sendmail'

Recently, my linux servers sendmail program stopped working and every time I send an email I get this error:

Warning: mail() [function.mail]: Could not execute mail delivery program '/usr/sbin/sendmail' in /var/www/includes/Swift-4.0.6/lib/classes/Swift/Transport/SimpleMailInvoker.php on line 50

Now, I've traced through my web application and surely there is no problem there. So, the problem lies in executing sendmail. It used to work before so I'm not sure why it would stop all of a sudden, and I don't recall making any server changes either. I've also tried reinstalling sendmail, but I still get the same error.

One thing I noticed is that there is no file called sendmail in /usr/sbin/. However, there is an entire folder called sendmail in /usr/sbin/ and inside it there are executables and sendmail files there (sendmail.8, sendmail.h, and sendmail.0 files exist). Their execute permissions are also set fine. Is this something to worry about?

Any suggestions as to how to fix this problem?

Thanks in advance.


Solution 1:

You have a bad installation somehow.

It is conventional on Unix that a program exists in /usr/sbin/sendmail$, which acts as an interface to the local MTA. This MTA is rarely sendmail nowadays, but other MTA's have a compatible program which is installed here.

sendmail.h would be part of the source code for sendmail, and sendmail.0 and sendmail.8 would be the man pages, so it looks like you've somehow got the source code for the right sendmail in /usr/sbin

You need to clean this up, and get a proper sendmail program into /usr/sbin/sendmail to fix php. Since you've not told us the distribution, nor which MTA you're actually using, no-one else can help you.

$ = Actually one or more of /usr/lib/sendmail and /usr/bin/sendmail as well as /usr/sbin/sendmail, programs will either search these paths, or have one or more hardcoded into them, or ask at installation time. It looks like your program is using /usr/sbin/sendmail. Regardless of which, the installation for the MTA will do it.