---
title: Postfix
source: https://synapx.fr/blog/postfix/
date: 2026-06-26
category: Email
site: SynapxLab
---

# Postfix : installation et configuration

Documentation officielle : [www.postfix.org](https://www.postfix.org/)

## Installation

```bash
sudo apt install postfix

sudo nano /etc/postfix/main.cf
```

```ini
mydomain = example.com
myorigin = /etc/mailname
relayhost = [smtp.example.com]:587
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
```

```bash
sudo tail -f /var/log/mail.log
sudo systemctl restart postfix
```

## Tester l'envoi d'e-mails

```bash
sudo apt install mailutils -y
echo "Ceci est un email de test" | mail -s "Sujet de l'email de test" mon@email.com
```

## Activer l'authentification SASL

```bash
sudo apt install libsasl2-modules
sudo nano /etc/postfix/main.cf
```

```ini
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_security_level = may
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
```

```bash
sudo nano /etc/postfix/sasl_passwd
```

```ini
[smtp.example.com]:587 username:password
```

```bash
sudo postmap /etc/postfix/sasl_passwd
sudo chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
sudo chmod 600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db

sudo systemctl restart postfix
```
