1825775 Members
2173 Online
109687 Solutions
New Discussion

sendmail and mail/mailx

 
Venu_2
Regular Advisor

sendmail and mail/mailx

Hi All,

What is the difference between sendmail and mail/mailx ? If i need to send mail (using mail/mailx) from my unix box do i need sendmail to be configured and running ? We don't want to run sendmail and would like disable it permanently, how can we do that ?

1. Can any non-root user start the sendmail service ?

2. Can any normal user send mail using "sendmail" when the "sendmail" server is not configured/running ?

3. How to findout if sendmail was started/stopped? (by checking the logs and where are they located)

Finally, we have stopped sendmail server on the box but while randomly checking i found the following process running. How can this happen ?

root 7760 7756 0 10:20:01 ? 0:00 sendmail -oem -oi -froot root
root 7775 1 0 10:20:03 ? 0:00 sendmail: KAA07733: from queue

Some of the above questions may be very basic, hope you guys bare with me.

Thanks a lot

Venu
6 REPLIES 6
Michael Tully
Honored Contributor

Re: sendmail and mail/mailx

Sendmail is a service or server daemon, therefore it does not have to be running to send email.

1. no
2. See explanation above, but they can use elm/mailx
3. The sendmail daemon does not write to the syslog or mail log by default when stopping, but writes to /var/adm/syslog/mail.log when starting

Seems that you may have stopped sendmail running whilst it was in the midst of sending a message.
Anyone for a Mutiny ?
Sridhar Bhaskarla
Honored Contributor

Re: sendmail and mail/mailx

Hi Venu,

1. No non-root users will not be able to start sendmail 'service'. But they can execute sendmail to send their mails in which case sendmail will be invoked as a client.

2. Yes. However, mail delivery is dependent on your system's ability to resolve and connect to the destination systems. Most of the cases, it is done by specifying mail exchangers in DS macro of /etc/mail/sendmail.cf file

3. If the sendmail is running as a daemon to receive mails on the server, you will see a process like 'sendmail -bd -q ##m' or "sendmail: accepting connections'. Another way is to telnet to the SMTP port. 'telnet localhost 25' should say connection refused.

The processes you are seeing are the sendmail processes where sendmail is trying to process the queue.

-Sri


You may be disappointed if you fail, but you are doomed if you don't try
Venu_2
Regular Advisor

Re: sendmail and mail/mailx

Hi Michael/Sridhar,

Thanks for the answers & your time.

Michael,

We have disabled sendmail( startup) several weeks back. As i said while doing a random check i found these process. So don't know how these got invoked ?

/var/adm/syslog/mail.log has a lot of entries ( today's date as well) indicating some activity is going on in sendmail. But these might be sendmail as client, how do we confirm that ? Our requirement is not sendmail server should be run/used

Sridhar,

"The processes you are seeing are the sendmail processes where sendmail is trying to process the queue."
Does this mean the sendmail server process is processing the queue ? or the sendmail client process ?

I did a telnet and it promptly gave the "connection refused" message indicating the server is not running, but can the server process start/stop by itself ( to process the queue)

Is sendmail when running as client is equal to mail/mailx ?

Thanks
Sridhar Bhaskarla
Honored Contributor

Re: sendmail and mail/mailx

Hi Venu,

mailx, mail, elm etc., are called MUAs (Mail User Agent) that are nothing but interfaces to MTA (Mail Trasnport Agent) sendmail. So, even if you run mailx or mail, they are going eventually invoke sendmail. And you can also use sendmail directly as a client to send messages. Are they equal?. Not necessarily as mailx,elm and mail are interfaces to the users and they themselves differ in their features.

In your case, sendmail is actually working to send the mail out of your box. In that state, it won't receive mail. You will be seeing something like "sendmail: Accepting connections" if sendmail is receiving mails.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Geoff Wild
Honored Contributor

Re: sendmail and mail/mailx

If you can not telnet to port 25 - it means either sendmail is not running as a daemon or the port is blocked with something like Ipfilter.

ps -ef |grep sendmail

If you see something like:

root 1904 1 0 Sep 25 ? 12:34 sendmail: accepting connections

Then it is a daemon.

It can NOT start by itself...however, the queue can be processed via a cron job as root like so:

# Make sure any queued mail is delivered, as sendmail isn't a daemon anymore
0,30 * * * * /usr/sbin/sendmail -q


To ensure sendmail will not start as daemon on reboot, ensure SENDMAIL_SERVER=0 in /etc/rc.config.d/mailservs

Rgds...Geoff

Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Steven E. Protter
Exalted Contributor

Re: sendmail and mail/mailx

Something to note:

If you shut down the sendmail daemon, you have disabled inbound mail collection.

Mail can still be sent between uers on the machine.

sendmail itself can still send outbound mail via a sendmail script.

Many websites uses sendmail perl scripts to send mail.

Any user can use the sendmail binary to send mail, though its pretty cumbersome.

Whether that mail gets anywhere depends on your network configuration.

If you want to totally stop use of sendmail, change permissions on the binary. I recommend against that. Its possible sendmail scripts are in use by system utilities, though I usually use mailx when I write such things.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com