Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| 04-linux:60-ssmtp [2016/07/19 17:25] – Roge | 04-linux:60-ssmtp [2018/09/22 06:28] (Version actuelle) – [SSMTP for GMAIL] Roge | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | ====== ssmtp ====== | ||
| + | Send mail sans serveur de mail | ||
| + | |||
| + | ===== Références ===== | ||
| + | |||
| + | [[http:// | ||
| + | |||
| + | [[http:// | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | [[http:// | ||
| + | |||
| + | ===== Mise en service ===== | ||
| + | |||
| + | |||
| + | sSMTP permet à des applications d' | ||
| + | |||
| + | sSMTP est disponible sous Ubuntu, Raspbian, Cygwin et bien d' | ||
| + | |||
| + | '' | ||
| + | |||
| + | |||
| + | Créer les paramètres de configuration (Cf. [[http:// | ||
| + | |||
| + | '' | ||
| + | |||
| + | < | ||
| + | # | ||
| + | # Config file for sSMTP sendmail | ||
| + | # | ||
| + | # The person who gets all mail for userids < 1000 | ||
| + | # Make this empty to disable rewriting. | ||
| + | root=xxx@provider.com | ||
| + | |||
| + | # The place where the mail goes. The actual machine name is required no | ||
| + | # MX records are consulted. Commonly mailhosts are named mail.domain.com | ||
| + | mailhub=smtp.provider.com | ||
| + | AuthUser=xxx | ||
| + | AuthPass=xxxxxxx | ||
| + | |||
| + | # Where will the mail seem to come from? | ||
| + | rewriteDomain=provider.com | ||
| + | |||
| + | # The full hostname | ||
| + | hostname=localhost | ||
| + | |||
| + | # Are users allowed to set their own From: address? | ||
| + | # YES - Allow the user to specify their own From: address | ||
| + | # NO - Use the system generated From: address | ||
| + | FromLineOverride=YES | ||
| + | </ | ||
| + | |||
| + | Rendre le fichier ssmtp.conf lisible uniquement par l' | ||
| + | |||
| + | '' | ||
| + | |||
| + | Modifier le propriétaire et le groupe de ssmtp.conf pour éviter l' | ||
| + | |||
| + | '' | ||
| + | |||
| + | Set the group owner of the ssmtp binary to the new ssmtp group: | ||
| + | |||
| + | '' | ||
| + | |||
| + | Set the SGID bit on the ssmtp binary. | ||
| + | |||
| + | '' | ||
| + | |||
| + | |||
| + | Les utilisateur pouvant envoyer des mails doivent appartenir au groupe " | ||
| + | |||
| + | '' | ||
| + | |||
| + | Configurer les revaliases : | ||
| + | |||
| + | '' | ||
| + | |||
| + | < | ||
| + | # sSMTP aliases | ||
| + | # | ||
| + | # Format: | ||
| + | # | ||
| + | # Example: root: | ||
| + | # where [:port] is an optional port number that defaults to 25. | ||
| + | |||
| + | root: | ||
| + | bob: | ||
| + | |||
| + | </ | ||
| + | |||
| + | Pour tester la solution, il peut être nécessaire de se délogger avant de lancer la commande : | ||
| + | |||
| + | '' | ||
| + | |||
| + | ===== Compléments ===== | ||
| + | |||
| + | Pour améliorer les informations de l' | ||
| + | |||
| + | '' | ||
| + | |||
| + | ===== Fichier attachés ===== | ||
| + | |||
| + | Installer uuencode pour envoyer des fichiers attachés : | ||
| + | |||
| + | '' | ||
| + | |||
| + | Pour envoyer un fichier attaché : | ||
| + | |||
| + | '' | ||
| + | |||
| + | |||
| + | Exemple classique d' | ||
| + | |||
| + | < | ||
| + | |||
| + | <note tip> | ||
| + | Sur le Raspberry, le uuencode n'a pas la même version (4.11.1 au lieu de 4.14 sur Ubuntu). Le fichier attaché se retrouve dans le corps du mail et non attaché. | ||
| + | </ | ||
| + | ===== Logs ===== | ||
| + | |||
| + | Pour vérifier les logs : | ||
| + | |||
| + | '' | ||
| + | |||
| + | <note warning> | ||
| + | Les logs affichent le message : | ||
| + | |||
| + | '' | ||
| + | |||
| + | Pourtant les mails sont envoyés !!! FIXME | ||
| + | </ | ||
| + | |||
| + | ===== Remerciements ===== | ||
| + | |||
| + | Special Thanks to [[https:// | ||
| + | |||
| + | ===== Cygwin ===== | ||
| + | |||
| + | '' | ||
| + | |||
| + | ===== SSMTP for GMAIL ===== | ||
| + | |||
| + | contenu du fichier ''/ | ||
| + | < | ||
| + | root=$mail | ||
| + | # The place where the mail goes. The actual machine name is required no | ||
| + | # MX records are consulted. Commonly mailhosts are named mail.domain.com | ||
| + | mailhub=smtp.gmail.com: | ||
| + | |||
| + | # Debug=Yes | ||
| + | |||
| + | FromLineOverride=YES | ||
| + | |||
| + | AuthUser=$mail | ||
| + | AuthPass=$pass | ||
| + | UseSTARTTLS=YES | ||
| + | UseTLS=YES | ||
| + | </ | ||
| + | |||
| + | ==== UFW ==== | ||
| + | |||
| + | |||
| + | Pour GMail il faut ajouter la règle suivante à ufw: | ||
| + | < | ||
| + | sudo ufw allow out 587/tcp | ||
| + | </ | ||