Unhandled exception: Failed to send the mail: /usr/sbin/sendmail is missing

Hi all,

I hust configured postifx to send email notification, tested without checkmk is working.

Once I enable notification on Checkmk i keep get this error

Unhandled exception: Failed to send the mail: /usr/sbin/sendmail is missing

How I can fix this, can someone help me?

Thanks
Riccardo

So /usr/sbin/sendmail is obviously missing. Or does it exist?

That path is used for historical and compatibility reasons.
It is usually a symlink pointing to your real MTA (postfix in your case).
Normally, your distribution should have created that symlink for you.

path seems exist

 ls -l /usr/sbin/sendmail*
lrwxrwxrwx. 1 root root      21 Nov 10 12:49 /usr/sbin/sendmail -> /etc/alternatives/mta
-rwxr-xr-x. 1 root root   29320 Dec  2  2020 /usr/sbin/sendmail.postfix
-rwxr-sr-x. 1 root smmsp 847464 Dec  3  2020 /usr/sbin/sendmail.sendmail

but i don’t know how to link it on checkmk

What Linux distribution is this? Looks like Debian (or Debian-based like Ubuntu).

Where does that /etc/alternatives/mta symlink point to?

You have probably some leftover from a sendmail installation. Check with dpkg -l | fgrep sendmail.
If you want to use postfix, you should probably not only remove but purge packages from other MTAs like sendmail.

Or you can use update-alternatives to fix the symlink.

No change in Checkmk required. The sendmail command has to be functional in your Linux setup.
Check with sendmail -bv your.mail@address.example

it’s a Centos8, i’m not very skilled on linux

mail@gmail.com... deliverable: mailer esmtp, host gmail.com., user mail@gmail.com
# dpkg -l | fgrep sendmail
# blank no output

Yes, that’s only for .deb based distributions like Debian.

What does type sendmail yield?

Wait, no output? Is there really a dpkg command on CentOS?

Try rpm -qa | grep -i sendmail to verify it is installed.

What about the link /etc/alternatives/mta, where does that lead to?

this is the output

# rpm -qa | grep -i sendmail
sendmail-8.15.2-34.el8.x86_64

And about the link “/etc/alternatives/mta” i don’t know exactly how to verify it

ls -lah /etc/alternatives/mta

Hi,

how did you run the tests?

Karl

Output is this

lrwxrwxrwx. 1 root root 27 Nov 16 11:54 /etc/alternatives/mta -> /usr/sbin/sendmail.sendmail

I test inside OMD site with this command

OMD[mysite]:~$ echo “content” | mail -s test-subject mail@gmail.com

And on Centos using

echo "Test Postfix Gmail SMTP Relay " | mail -s "Postfix Gmail SMTP Relay 1" your-email-address@gmail.com

With both command I received email on my gmail mailbox

Hi,
you don’t need sendmail - postfix is enough. So let’s test:

rpm -qa | grep postfix

If postfix is installed, then let’s remove sendmail:

dnf remove sendmail

Karl

Ok done it but on CheckMK keep see the same message

# rpm -qa | grep postfix
postfix-3.5.8-1.el8.x86_64
# dnf remove sendmail
Removed:
  procmail-3.22-47.el8.x86_64                                                                sendmail-8.15.2-34.el8.x86_64   

maybe I’m missing something

Hi,
let’s try to create a symbolic link as root:

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

Karl

[root@]# ln -s /usr/sbin/sendmail.sendmail /usr/sbin/sendmail
ln: failed to create symbolic link '/usr/sbin/sendmail': File exists

Hi,
what’s the output of sestatus as root?

Karl

SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Memory protection checking:     actual (secure)
Max kernel policy version:      33