Sendmail

Sendmail est basé au tour de 2 fichiers :

  • sendmail.mc le fichier source qui génère le fichier final sendmail.cf à chaque relancement du service sendmail
  • sendmail.cf

Relay avec sendmail

La variable DS détermine le serveur relay à utiliser

DSsmtp.monserveur.com

Dans le fichier .mc

define(`SMART_HOST',`smtp.monserveur.com')

Maquerade

La variable DM détermine le masquerade

DMtoto

Enverra vos mail en user@toto.hostnameduserveurrelay.com

Dans le fichier .mc

MASQUERADE_AS(`toto')dnl
DMmonserveur.fr

Enverra vos mail en user@monserveur.fr

Dans le fichier .mc

MASQUERADE_AS(`monserveur.fr')dnl

Ressources

Erreurs

aide.sivit.fr

Suite à un reboot, vos mails ne fonctionne pas, c'est une erreur fréquente. En fait, lorsqu'un serveur redémarre, la configuration de sendmail se fait régénérer. Il faut donc pour éviter les mauvaise surprises non pas modifier le fichier sendmail.cf (très tentant) mais bel et bien le sendmail.mc Par la suite, lorsque le fichier est modifié, vous n'avez qu'a exécuter la commande suivante :

m4 sendmail.mc > sendmail.cf

Cela va générer un fichier de configuration valide.

Cette astuce est notifiée dans le fichier .cf et .cf

######################################################################
######################################################################
#####
#####           SENDMAIL CONFIGURATION FILE
#####
##### built by root@MYSERVER on dimanche 04 avril 2007, 16:07:46 (UTC+0200)
##### in /etc/mail
##### using /usr/share/sendmail/cf/ as configuration include directory
#####
######################################################################
#####
#####   DO NOT EDIT THIS FILE!  Only edit the source .mc file.
#####
######################################################################
######################################################################
#-
# $Sendmail: debproto.mc,v 8.14.3 2008-07-15 22:30:00 cowboy Exp $
#
# Copyright (c) 1998-2008 Richard Nelson.  All Rights Reserved.
#
# cf/debian/sendmail.mc.  Generated from sendmail.mc.in by configure.
#
# sendmail.mc prototype config file for building Sendmail 8.14.3
#
# Note: the .in file supports 8.7.6 - 9.0.0, but the generated
#       file is customized to the version noted above.
#
# This file is used to configure Sendmail for use with Debian systems.
#
# If you modify this file, you will have to regenerate /etc/mail/sendmail.cf
# by running this file through the m4 preprocessor via one of the following:
#       * make   (or make -C /etc/mail)
#       * sendmailconfig
#       * m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
# The first two options are preferred as they will also update other files
# that depend upon the contents of this file.
#
# The best documentation for this .mc file is:
# /usr/share/doc/sendmail-doc/cf.README.gz
#
#-

Autres ressources

Sendmail 8.12.11 cf/README - Sendmail Configuration Files