SMTP — Simple Mail Transfer Protocol

Couche OSI : L7 — Application
Ports : 25 (serveur→serveur) · 587 (submission, authentifié) · 465 (SMTPS, TLS implicite)

SMTP est le protocole qui gère l’envoi et le relayage des emails. Il ne gère que l’envoi — la réception et la lecture des emails se font via IMAP ou POP3.


Rôle dans l’écosystème email

Expéditeur (client mail)
  │── SMTP:587 ──►  Serveur SMTP sortant (ex: smtp.gmail.com)
                       │── SMTP:25 ──►  Serveur SMTP destinataire
                                           │  stocke le message
                                           │
                                       Destinataire
                                           │◄── IMAP:993 ── lit ses emails
ProtocoleDirectionPort
SMTPEnvoi et relayage25, 587, 465
IMAPLecture (synchronisation)143, 993 (TLS)
POP3Lecture (téléchargement)110, 995 (TLS)

Dialogue SMTP (exemple concret)

Client → smtp.monentreprise.fr:587

Client : EHLO client.monentreprise.fr        → "bonjour, je suis..."
Serveur: 250-smtp.monentreprise.fr           → "bonjour"
Serveur: 250-AUTH PLAIN LOGIN               → "j'accepte ces auth"
Serveur: 250 STARTTLS                       → "je supporte TLS"

Client : STARTTLS                           → "passons en chiffré"
Serveur: 220 Ready to start TLS
[négociation TLS]

Client : AUTH LOGIN                         → authentification
Serveur: 334 Username:
Client : YWxpY2U=                           → "alice" en base64
Serveur: 334 Password:
Client : bW90ZGVwYXNzZQ==                   → mot de passe en base64
Serveur: 235 Authentication successful

Client : MAIL FROM:<alice@monentreprise.fr>  → expéditeur
Serveur: 250 OK
Client : RCPT TO:<bob@exemple.com>           → destinataire
Serveur: 250 OK
Client : DATA                                → début du message
Serveur: 354 Start input, end with <CRLF>.<CRLF>
Client : From: Alice <alice@monentreprise.fr>
         To: Bob <bob@exemple.com>
         Subject: Réunion demain
         Date: Sat, 05 Apr 2026 10:00:00 +0200
         MIME-Version: 1.0
         Content-Type: text/plain; charset=UTF-8

         Bonjour Bob, la réunion est à 14h.
         .                                   → ligne avec un seul point = fin du message
Serveur: 250 Message queued as abc123

Client : QUIT
Serveur: 221 Bye

Les 3 ports SMTP

PortUsageChiffrement
25Relayage serveur→serveur (MTA to MTA)STARTTLS optionnel
587Envoi client→serveur (submission)STARTTLS obligatoire
465SMTPS — TLS implicite dès la connexionTLS immédiat

Le port 25 est bloqué par défaut chez la plupart des FAI et hébergeurs cloud pour les connexions sortantes — cela évite que les serveurs compromis envoient du spam directement.


STARTTLS vs TLS implicite

Port 587 — STARTTLS (TLS explicite) :
  Client → Serveur  [connexion en clair]
  Client : EHLO ...
  Serveur: 250 STARTTLS
  Client : STARTTLS       → "on passe en chiffré"
  [négociation TLS]
  [suite du dialogue chiffré]

Port 465 — TLS implicite :
  Client → Serveur  [TLS immédiatement dès la connexion]
  [négociation TLS]
  [dialogue chiffré directement]

Headers d’un email

From: Alice <alice@monentreprise.fr>
To: Bob <bob@exemple.com>
CC: Charlie <charlie@exemple.com>
BCC: audit@monentreprise.fr          ← invisible pour les autres destinataires
Subject: Compte-rendu réunion
Date: Sat, 05 Apr 2026 10:00:00 +0200
Message-ID: <abc123@monentreprise.fr>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----boundary"

; Headers ajoutés par les serveurs intermédiaires (traces de relayage)
Received: from smtp.monentreprise.fr by mx.exemple.com; Sat, 05 Apr 2026 10:00:05
Received: from client.local by smtp.monentreprise.fr; Sat, 05 Apr 2026 10:00:01
DKIM-Signature: v=1; a=rsa-sha256; d=monentreprise.fr; ...

MIME — pièces jointes et HTML

SMTP transmet du texte brut. MIME (Multipurpose Internet Mail Extensions) permet d’envoyer du HTML et des pièces jointes :

Content-Type: multipart/mixed; boundary="----sep"

------sep
Content-Type: text/plain; charset=UTF-8

Bonjour, veuillez trouver le document en pièce jointe.

------sep
Content-Type: application/pdf; name="rapport.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="rapport.pdf"

JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2cvUGFnZ...

------sep--

Sécurité email : SPF, DKIM, DMARC

SMTP seul n’authentifie pas l’expéditeur — n’importe qui peut forger From:. Ces enregistrements DNS protègent :

MécanismeVérifieDétail
SPFL’IP d’envoi est autoriséeDNS - TXT
DKIMLe contenu n’a pas été modifiéDNS - TXT
DMARCPolitique en cas d’échec SPF/DKIMDNS - TXT

En relation avec