m4 Configuration

Here's a sample m4 configuration file, for the purposes of this I'll assume you want to put all the configuration files except sendmail.cf in /etc/mail. sendmail.cf itself should be in your /etc directory. Your m4 file (let's call it demon.mc) should be in /usr/lib/sendmail-cf/cf if your m4 configuration files are in /usr/lib/sendmail-cf.

divert(-1)
include(`../m4/cf.m4')
This is standard preamble to an m4 file
OSTYPE(`linux')
Change to something more appropriate if you're not running Linux
define(`confDEF_USER_ID',``8:12'')
The is the UserId:GroupId of sendmail. Generally for the mail user and group; who should be able to write to files in /var/spool/mqueue and /var/spool/mail.
define(`confFALLBACK_MX', post.demon.co.uk)
I use a FallBackMX, so my sendmail tries to deliver directly and if that fails it will use post.demon.co.uk. If you want to just send all mail to post.demon.co.uk then replace this with define(`confSMART_HOST', post.demon.co.uk)
define(`confMAX_MESSAGE_SIZE',50000)
The maximum message size is 50k; adjust to suit or you can omit this line
define(`confPRIVACY_FLAGS',`goaway,noreceipts')
This is just security really; prevents people from using EXPN or VRFY to gather information about your users. Again if you're not bothered you can omit this.
define(`confBIND_OPTS',`-DNSRCH HasWildcardMX')
This is necessary to cope with Demon's wildcard MX for .demon.co.uk.
define(`confCOPY_ERRORS_TO',postmaster)
Any errors in delivery are cc-ed to postmaster
define(`confCT_FILE', ` -o /etc/mail/sendmail.ct')dnl
This is a file of trusted users who can change the From address and return-path without sendmail complaining. If you run mailing lists with majordomo or something like that you should probably put them in here. For normal use you could probably omit this line and the line FEATURE(use_ct_file) below.
define(`confCW_FILE', ` /etc/mail/sendmail.cw')dnl
All domains for which sendmail should accept mail go in here; one per line. At the very least you should have localhost and your full Demon hostname in here. This is very important - without your Demon hostname in here you will bounce all email sent to you.
define(`confSTATUS_FILE',`/var/run/sendmail.st')dnl
define(`ALIAS_FILE',`/etc/mail/aliases,/etc/mail/majordomo')dnl
Files full of aliases are listed here. If you're not running majordomo you probably only need the first.
define(`HELP_FILE',`/etc/mail/sendmail.hf')dnl
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl
This should be the path to your procmail binary
define(`STATUS_FILE',`/var/run/sendmail.st')dnl
undefine(`UUCP_RELAY')
undefine(`BITNET_RELAY')
I doubt anyone seriously has to resolve uucp or bitnet addresses anymore....
FEATURE(redirect)
FEATURE(always_add_domain)
FEATURE(use_cw_file)
FEATURE(use_ct_file)
FEATURE(accept_unresolvable_domains)
Sendmail will bounce unresolvable domains by default. This turns off this very silly behaviour.
FEATURE(access_db, hash -o /etc/mail/access)
This is your access database where you can restrict who can send you mail. The syntax is detailed off the sendmail home page.
FEATURE(local_procmail)
MAILER(smtp)

Once your saved your m4 file you can generate a sendmail.cf with

m4 demon.mc > demon.cf

Then simply copy demon.cf onto /etc/sendmail.cf.


Home - Up - Starting Sendmail