all:bibles:linux:smtp
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| all:bibles:linux:smtp [2025/01/02 12:13] – [Utilisation] omeylhoc | all:bibles:linux:smtp [2025/03/31 14:46] (Version actuelle) – [Utilisation] omeylhoc | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | ====== Client SMTP ====== | ||
| + | ---- | ||
| + | |||
| + | ===== Envoie de mail en ligne de commande ===== | ||
| + | |||
| + | ==== Installation ==== | ||
| + | |||
| + | Installer le paquet <color # | ||
| + | |||
| + | <code bash> | ||
| + | sudo apt install msmtp | ||
| + | </ | ||
| + | |||
| + | ==== Configuration ==== | ||
| + | |||
| + | * Editer le fichier <color # | ||
| + | |||
| + | < | ||
| + | account default | ||
| + | host smtp.monfai.fr | ||
| + | from prenom.nom@monfai.fr | ||
| + | auth off | ||
| + | #auth on | ||
| + | #si jamais auth off ne passe pas | ||
| + | user prenom.nom | ||
| + | #si votre fai vous identifie plus clairement si vous reprécisez le domaine, alors plutôt cela : | ||
| + | #user prenom.nom@fai.fr | ||
| + | password monmotdepasse | ||
| + | </ | ||
| + | |||
| + | * Modifier les droits d' | ||
| + | |||
| + | <code bash> | ||
| + | chmod 600 ~/.msmtprc | ||
| + | </ | ||
| + | |||
| + | ==== Utilisation ==== | ||
| + | |||
| + | Créer un fichier avec le contenu du mail. Par exemple <color # | ||
| + | |||
| + | < | ||
| + | From: mon-adresse@domaine.xx | ||
| + | To: destinataire@domaine.xx | ||
| + | Content-Type: | ||
| + | Content-Transfer-Encoding: | ||
| + | MIME-Version: | ||
| + | subject: le sujet de l' | ||
| + | |||
| + | le corps du texte commence à cette ligne (laisser une ligne blanche) | ||
| + | <br> | ||
| + | Il faut utiliser le html pour le multi lignes | ||
| + | </ | ||
| + | |||
| + | Adapter l' | ||
| + | Puis envoyer le mail par la commande : | ||
| + | |||
| + | <code bash> | ||
| + | cat mail.txt | msmtp " | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | [[all: | ||
| + | |||
| + | ===== Exemple avec free ===== | ||
| + | |||
| + | ==== Configuration msmtp ==== | ||
| + | |||
| + | === .msmtprc === | ||
| + | |||
| + | < | ||
| + | account free | ||
| + | host smtp.free.fr | ||
| + | from toto@free.fr | ||
| + | auto_from off | ||
| + | add_missing_from_header on | ||
| + | auth on | ||
| + | port 587 | ||
| + | user toto@free.fr | ||
| + | password xxxxxxx | ||
| + | logfile / | ||
| + | tls on | ||
| + | tls_starttls on | ||
| + | tls_trust_file / | ||
| + | account default : free | ||
| + | </ | ||
| + | |||
| + | ==== Test ==== | ||
| + | |||
| + | <code bash> | ||
| + | echo ' | ||
| + | </ | ||
| + | |||
| + | ==== Debug ==== | ||
| + | |||
| + | <code bash> | ||
| + | echo ' | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | [[all: | ||
| + | |||
| + | ===== Sources ===== | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | ---- | ||
| + | |||
| + | [[all: | ||
