What is the process `sendmail`?

When I type top commond, I see many sendmail, what are these sendmail? I never set mail in my service.

SER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
16110 root      17   0  234m  35m 8380 R 45.3  1.7   0:02.53 php
16101 root      17   0  230m  31m 8100 R 43.3  1.5   0:02.06 php
16092 root      15   0  219m  20m 8100 S 21.0  1.0   0:01.32 php
16104 root      15   0  226m  26m 8096 S 13.6  1.3   0:01.64 php
16107 root      16   0  215m  16m 8080 R  5.3  0.8   0:00.21 php
16096 root      15   0  216m  18m 8088 S  2.7  0.9   0:00.71 php
16122 smmsp     18   0 76032 4380 2904 S  1.7  0.2   0:00.07 sendmail
16125 smmsp     18   0 76024 4368 2904 S  1.7  0.2   0:00.06 sendmail
16137 root      17   0 80976 3836 1388 R  1.3  0.2   0:00.04 sendmail
16099 root      18   0 39100 1672  924 R  1.0  0.1   0:00.03 crond
16108 root      18   0 39100 1672  924 R  1.0  0.1   0:00.04 crond
16060 root      15   0 15004 1288  992 R  0.3  0.1   0:00.05 top
16091 root      18   0 39100 1672  924 S  0.3  0.1   0:00.02 crond
16095 root      18   0 39100 1672  924 S  0.3  0.1   0:00.01 crond
16102 root      18   0 39100 1672  924 S  0.3  0.1   0:00.03 crond
16116 smmsp     18   0 76024 4364 2904 S  0.3  0.2   0:00.02 sendmail
16117 smmsp     18   0 76024 4364 2904 S  0.3  0.2   0:00.02 sendmail
Asked By: fish man

||

Sendmail is an MTA (Mail Transport Agent) available for various Unix-like operating systems. It can also serve as an MDA (Mail Delivery Agent). It might be installed by default with your OS or it was a dependency of some sort for other software.

Please refer to the documentation that comes with your OS for the Sendmail package for more information on how to configure it. I cannot determine whether you actually need it based on the information you give.

Answered By: gertvdijk

The other answers tell you what sendmail is. My answer is that sendmail is very likely being triggered by whatever web site you’ve got running under PHP (maybe a forum, sending registration or subscription e-mails) or the something similar.

Answered By: EightBitTony

Update from comments

It looks as though my understanding of sendmail is far from complete and much of the information originally posted below is incorrect.

Comments are very easy to overlook here, so I’m reproducing them here to prevent the errors in the original text from being read as fact.

Sendmail

Thanks for the correction, raj!

sendmail is a complete MTA.
It handles both sending and receiving mail, both locally within the server and externally.

It all depends on the configuration.
There is no separate smtpd program in the sendmail package, sendmail does that function by itself.

newaliases and mailq are helper programs for sendmail, but they are by no means necessary for it to operate.

Reading received mail is not the MTA‘s job, it’s the MUA‘s job.
Many Unix-like systems include by default a MUA called simply mail, but you can install any other.

SMTPD

You are also wrong with regard to a function of an SMTP daemon.
SMTP daemon is for receiving inbound mail from the Internet, not for sending outbound mail to the Internet.
Sending mail to the internet is done with an SMTP client.

sendmail serves both functions, contrary to some other MTAs that have separate processes for both.

For example, Postfix has a separate smtpd and smtp process, plus a bunch of others).

Ignore this because it’s wrong

It’s probably still a good idea to read the man pages for the programs described, though.

The long answer is that sendmail is, in practice, one of a number of programs that make up a complete mail service. It’s entirely possible that you don’t have this problem. Still, when I first attempted to run my own mail server it took me a very long time and a lot of frustration to figure this out, so hopefully, the subsequent (hopefully complete) explanation of mail services on Unix can help you avoid that.

Sendmail by itself does not constitute a complete mail server, it is only responsible for sending mail. It does not provide a facility for receiving mail or reading any mail received. You can find a full explanation of this on the sendmail man page.

If you’ve looked at the sendmail man page linked above, it’s worth noting the list of services at the top of that page, shown below.

  • sendmail [flags] [address …]
  • newaliases
  • mailq [-v]
  • hoststat
  • purgestat
  • smtpd

It’s been a few years since I was masochistic enough to run my own mail services, so I don’t recall the purpose of some of those services, but I’ll provide a brief explanation here of the ones I provide something at least simulating the facts on.

sendmail

This is the process running in your top command, but it won’t actually allow you to send mail to anyone but other users on the server in question. All this process does is receive mail messages and route them to either a queue to be read by the SMTP process or a local inbox.

newaliases

This program creates aliases between local user accounts and what would otherwise be external email addresses. So, if your server has a public domain name associated with it, you can use newaliases tell sendmail to regenerate its database of local email address aliases, which is itself stored in /etc/aliases. The procedure for this would be to change the contents of /etc/aliases and then run the newaliases command to have a new address database generated by sendmail.

mailq

This program allows you to view the contents of the mail queue to see which messages are waiting to be sent by the SMTP service. IIRC the queue itself is stored either in a subdirectory of /var/spool/ or a subdirectory of /var/mail, but don’t quote me on that as it’s been a while.

smtpd

The SMTP daemon is what will actually handle sending mail to addresses that cannot be found in the local aliases file (/etc/aliases). It will read messages from the local mail queue and, when an address is remote, send that message to the first hop in the chain of servers that the message will pass through before it hits the intended recipient’s inbox.

Answered By: Xander Harris
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.