My VPS image (Debian 6) comes pre-installed with sendmail as the MTA. I will use this server as a web server, and maybe other usages but not as a mail server. I want to remove as many unneeded services as possible to save resources. Can the MTA be safely removed? What are the consequences?


One consequence of removing the MTA is that mail generated by the system itself (usually sent to root), for example by Cron, Logwatch, rkhunter and others cannot be be delivered.

So yes, an MTA is an integral part of any Unix-like system and I doubt Debian will let you uninstall the MTA without complaining and suggesting an alternative. But it's not a big deal. By default in Debian even sendmail will only listen on and relay mail only locally, so there is no real security risk here.

  • A small addition to this answer though. Some unexperienced administrators keep MTA as it is, which may lead to disappearing disk space. Our 3rd party hoster did not even think about it until we ran out of space in /var. Default partition size was 4G, 1.5G was consumed by logs and the rest eaten up by /var/spool/mail. Which makes it not a security risk, but rather general administration issue. – Alexey Kamenskiy Mar 23 '15 at 3:27

The MTA is used to handle all kinds of messaging, not just email to user mailboxes. On my CentOS system, it is using a whopping 4 MB of RAM. That's less than one PHP thread. Don't jeopardize the stability and operation of your server for a pittance of extra capacity. Buy more capacity instead.


Instead of removing sendmail (or any other MTA) for reasons explained in other answers, you can configure it to send all system generated email to a mail account of your choice, so as to review it at a later time.

Since this is a Debian system, backup your /etc/mail/sendmail.mc and then replace it with the contents below:


dnl # define(`SMART_HOST', `[outgoing.example.com]')dnl
define(`confCW_FILE', `-o /etc/mail/local-host-names')dnl

DAEMON_OPTIONS(`Name=MTA-v4, Addr=, Port=smtp')dnl
DAEMON_OPTIONS(`Name=MSP-v4, Addr=, Port=submission')dnl


# LHS is separated from RHS with tabs, not whitespaces
R$- <@ $=w . >          john.doe < @ example.com. >

Two notes:

  1. You may not need the SMART_HOST line. That is why it is already commented out.
  2. In the last line the left hand side is separated from the right hand side with tabs, not spaces. So do not copy-paste, type by hand.

After you are done, run sendmailconfig and check whether this solution works for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.