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.