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 runssendmail
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 thesendmail
variable: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
.