Linux – I stopped sendmail service and started postfix. Sendmail still shows in email logs

emaillinuxpostfixsendmail

This server has both sendmail and postfix installed. Sendmail has been running but is not working properly. I stopped the sendmail service and started postfix.
Confirmed only postfix is running by checking the output of what is listening on port 25.

lsof -i :25
COMMAND    PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME

master  119640 root   12u  IPv4 28103863      0t0  TCP localhost:smtp (LISTEN)

master  119640 root   13u  IPv6 28103864      0t0  TCP localhost:smtp (LISTEN)

Then I test sending mail:

echo "My message" | mail -s testing root@server.domain.com

It doesn't arrive in root's inbox. So I take a look at the logs at /var/log/maillog and see sendmail is still being used:

Feb 26 16:18:13 server sendmail[1582]: w1QLIC8N001582: to=root@server.domain, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30233, relay=exchangeserver.domain. [x.x.x.x], dsn=2.0.0, stat=Sent (<201802262118.w1QLIC8N001582@root@server.domain> Queued mail for delivery)

How is this possible?

Best Answer

The mail program runs sendmail to deliver the mail (in the client mode, no listening port is being open in the process). Read the man page for detailed information. You may change the MDA by setting the sendmail variable:

sendmail

To use an alternate mail delivery system, set this option to the full pathname of the program to use. This should be used with care.

$ sendmail=/usr/bin/someothersendmail mail somebody@somewhere.com
Subject: asdf
... and so on

But as mail expects the MDA to recognize sendmail's options, I don't really se the use for it.

Another possibility is to use an external SMTP server instead of sendmail.

$ echo "This is the message body and contains the message" | mailx -v \
> -r "someone@example.com" \
> -s "This is the subject" \
> -S smtp="mail.example.com:587" \
> -S smtp-use-starttls \
> -S smtp-auth=login \
> -S smtp-auth-user="someone@example.com" \
> -S smtp-auth-password="abc123" \
> -S ssl-verify=ignore \
> yourfriend@gmail.com
Related Topic