Skip to content

How to Install Sendmail on Debian 9 (Stretch)?

Updated 1 min read

Updated: 28 September 2026 · Applies to: Debian 12 and Ubuntu 24.04

Debian 9 is end of life. Sendmail is one of the oldest mail transfer agents. It still works on Debian 12 and Ubuntu 24.04, but most new servers use Postfix, which is easier to configure and secure.

Install Sendmail

apt install sendmail
sendmailconfig          # answer Y to the questions to generate the configuration
systemctl status sendmail

Settings are in /etc/mail/sendmail.mc; after changes, run sendmailconfig (or make -C /etc/mail) and restart. By default Sendmail accepts mail only from the server itself, which is what you want for sending website mail.

Test

echo "Test body" | mail -s "Test" you@example.com     # needs mailutils
tail -f /var/log/mail.log

For sending website email

  • Set up SPF, DKIM and DMARC for your domain, and ask support to set the reverse DNS (PTR) of the server's IP to its hostname; otherwise mail is often marked as spam.
  • Many providers block outgoing port 25 on new servers; sending through an authenticated SMTP relay (port 587) avoids this.
  • If you only need to send mail from applications, a small relay-only setup of Postfix (or msmtp) is simpler than a full Sendmail installation.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Linux server management

hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.

Was this answer helpful?

Still stuck? Open a ticket