Installer les paquets Nécessaires
root@raspberrypi32G#apt-get update && apt-get upgrade root@raspberrypi32G#apt-get install sendmail
Sauvegarde du fichier source
root@raspberrypi32G# cp /etc/mail/sendmail.mc /etc/mail/sendmail.mc.sauvegarde
Editer le fichier sendmail.mc
Effacer toute les lignes et ajouter les lignes suivantes
root@raspberrypi32G#vi /etc/mail/sendmail.mc #----------------------------------------------------------------------------- divert(0)dnl # # Copyright (c) 1998-2005 Richard Nelson. All Rights Reserved. # # This file is used to configure Sendmail for use with Debian systems. # include(`/usr/share/sendmail/cf/m4/cf.m4')dnl OSTYPE(`linux')dnl define(`SMTP_MAILER_FLAGS', `e9')dnl FEATURE(redirect)dnl FEATURE(nocanonify)dnl FEATURE(always_add_domain)dnl FEATURE(local_procmail)dnl GENERICS_DOMAIN(localhost.localdomain localhost localhost) FEATURE(genericstable) FEATURE(masquerade_envelope)dnl define(`confCF_VERSION',`cf à ede - 22/05/98')dnl define(`confCON_EXPENSIVE',`True')dnl define(`confME_TOO',`True')dnl define(`confCOPY_ERRORS_TO',`Postmaster')dnl define(`confDEF_CHAR_SET',`ISO-8859-1')dnl define(`confMIME_FORMAT_ERRORS',`True')dnl define(`SMART_HOST',`smtp8:[smtp.free.fr]')dnl define(`confTO_QUEUEWARN',`24h') MAILER(local) MAILER(smtp)
root@raspberrypi32G# m4 sendmail.mc > /etc/mail/sendmail.cf
Configurer « genericstable »
root@raspberrypi32G# touch genericstable root@raspberrypi32G# touch genericstable.db root@raspberrypi32G#vi genericstable pi : chris@free.fr chris@en-images.info root@raspberrypi32G # sendmail -bi -oA/etc/mail/genericstable
Changer les droits sur les répertoires des spool
root@raspberrypi32G # chown -R root:smmsp /var/spool root@raspberrypi32G # chmod 770 /var/spool root@raspberrypi32G # chmod -R 0770 /var/spool/mqueue-client/
Configurer « aliases »
root@raspberrypi32G# vi aliases pi : chris root@raspberrypi32G # newaliases Correction message d’erreur suivant dans le fichier log « mail.log » SYSERR(root): hash map "Alias0": unsafe map file /etc/mail/aliases.db: Permission denied root@raspberrypi32G # rm /etc/mail/aliases.db root@raspberrypi32G # touch /etc/mail/aliases.db root@raspberrypi32G # newaliases
Relancer le serveur « Sendmail » MTA
root@raspberrypi32G # /etc/init.d/sendmail restart
Envoyer un mail en ligne de commande
root@raspberrypi32G# apt install mailutils root@raspberrypi32G# echo "Mon message $(date)" | mail -s "Test envoi de mail depuis $HOST" chris@free.fr
Views: 41