# sendmail.cf # version A1.27 # by Adam M. Costello # # # The intention of the A* versions is for the local host to send all # mail directly to its destination via TCP, except for mail addressed # to non-internet pseudo-domains (such as uucp and bitnet), which is # handled if possible or forwarded to the mailhost. # # This will work only if you use a sendmail that knows how to use DNS # and MX records, for example Sun's "sendmail.mx". # # This file is loosely based on the main.cf which came with Solaris 2.2. # I've removed a lot of copyright notices, so go read main.cf if you are # contemplating copying this file. ### Local configuration # Example: # Suppose this host is charlie.cs.eng.wustl.edu. # The variable w is automatically set to either "charlie" or # "charlie.cs.eng.wustl.edu" depending on your version of sendmail. # The variable m should be set to "cs.eng.wustl.edu". # The variable j should be set to the name that charlie should call # itself in "Received:" lines in headers. # The variable J should be set to charlie's primary name. Exactly what # this is depends on your name service. # The variable k should be set to the hostname you want to be used in # sender addresses to refer to charlie. You can set it to $j to be # honest, or to a name referring to some other host if you want all # your replies to go there. # The class A may be set to primary names of hosts for which charlie # should accept mail. # The variable/class R should be set to a host more knowledgeable about # strange addresses than charlie. Often this is "mailhost". # The variable M should be set to the mailer that can send mail to $R. # The class U should include all meaningful top-level pseudo domain # names which are not valid top-level Internet domain names. Mail # addressed to hosts in these top-level domains will be forwarded to # the mailhost if we don't know how to handle it. # The variable V should be set to a version string for this file. # Local domain Dmcs.wustl.edu # Hostname # If you want this host to identify itself as the domain, use: #Dj$m # Or, if you want this host to appear to be inside the domain, then use # one of of the next two depending on whether your sendmail sets w to # the one-word hostname or the fully qualified hostname. Dj$w.$m #Dj$w # Primary name # If none of the following is the primary name, write your own. DJ$w.$m #DJ$w #DJ$m # False hostname to use in local sender addresses # (If you don't want to lie, use same definition as for J.) Dk$m # Primary names of hosts for which we should accept mail CA # Forwarder DRmailhost CRmailhost # Mailer to use to send mail to forwarder DMether # Non-Internet top-level pseudo domains CU cpbitnet bitnet csnet decnet junet infnet mailnet span uucp # Version string DVECL-A1.27 # The only things below this line which might require modification are # marked with the word "CONFIG". Of course, you may want to change # other things, but it shouldn't be necessary for mail to work. ### Standard macros # name used for error messages DnMailer-Daemon # UNIX header format DlFrom $g $d # delimiter (operator) characters Do.:%@!^=/[] # format of a total name Dq$g$?x ($x)$. # SMTP login message De$j Sendmail $v/$V ready at $b ### Options # CONFIG # Your aliases file is probably in one of these three places: #OA/etc/aliases OA/etc/mail/aliases #OA/etc/sendmail/aliases # default delivery mode (deliver in background) Odbackground # rebuild the alias file automagically OD # temporary file mode -- 0600 for secure mail, 0644 for permissive OF0600 # default GID Og1 # CONFIG # Your help file is probably in one of these three places: #OH/usr/lib/sendmail.hf OH/etc/mail/sendmail.hf #OH/etc/sendmail/sendmail.hf # log level OL9 # default messages to old style Oo # Cc my postmaster on error replies I generate OPpostmaster # CONFIG # Your queue directory is probably in one of these two places: #OQ/usr/spool/mqueue OQ/var/spool/mqueue # read timeout for SMTP protocols Or15m # CONFIG # Your status file, if it exists, is probably in one of these four places: #OS/usr/lib/sendmail.st #OS/etc/sendmail.st OS/etc/mail/sendmail.st #OS/etc/sendmail/sendmail.st # queue up everything before starting transmission, for safety Os # return queued mail after this long OT1d # default UID Ou1 ### Message precedences Pfirst-class=0 Pspecial-delivery=100 Pjunk=-100 ### Trusted users # CONFIG T root daemon uucp # NeXTs use this instead: #T root daemon uucp agent ### Format of headers H?P?Return-Path: <$g> HReceived: $?sfrom $s $.by $j ($v/$V) id $i; $b H?D?Resent-Date: $a H?D?Date: $a H?F?Resent-From: $q H?F?From: $q H?x?Full-Name: $x HSubject: H?M?Resent-Message-Id: <$t.$i@$j> H?M?Message-Id: <$t.$i@$j> HErrors-To: ####################### ### Rewriting rules ### ####################### ### General code to recognize self S40 R$*<@$+>$* $:<$1<@$2>$3>$[$2$] find primary name of host R<$*<@$*>$*>$=A $:<$1<@$2>$3>$J accepted names -> our name # CONFIG # If you want to accept mail for anything.$J ($J is our name), uncomment # the following line: R<$*<@$*>$*>$*.$J $:<$1<@$2>$3>$J anything.our.name -> our.name R<$*<@$*>$*>$J $@$1<@$J>$3 if it's us, use primary name R<$*<@$+>$*>$* $@$1<@$2>$3 otherwise restore original ### Sender field pre-rewriting S1 R$* $:$>40$1 check for our names R$*<@$J>$* $@$1<@$k>$2 substitute false name for ours R$*<$*>$* $@$1<$2>$3 already has a host destination R$+ $@$1<@$k> otherwise supply ours ### Recipient field pre-rewriting S2 # None necessary. ### Name canonicalization # Internal format of names within the rewriting rules is: # anything<@host.domain.domain...>anything # We try to get every kind of name into this format, except for local # names, which have no host part. The reason for the "<>" stuff is that # the relevant host name could be on the front of the name (for source # routing), or on the back (normal form). We enclose the one that we # want to route on in the <>'s to make it easy to find. # S3 # handle "from:<>" special case R$*<>$* $@@ turn into magic token # basic textual canonicalization R$*<$+>$* $2 basic RFC822 parsing # make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later R@$+,$+:$+ @$1:$2:$3 change all "," to ":" R@$+:$+ $@<@$1>:$2 src route canonical R$+:$*;@$+ $@$1:$2;@$3 list syntax R$+@$+ $:$1<@$2> focus on domain R$+<$+@$+> $1$2<@$3> move gaze right R$+<@$+> $@$1<@$2> already canonical # Convert old-style names to domain-based names # All old-style names parse from left to right, without precedence. R$-!$+ $@$2<@$1.uucp> uucphost!user R$-.$+!$+ $@$3<@$1.$2> host.domain!user R$+%$+ $@$>3$1@$2 user%host ### Final output post-rewriting S4 # CONFIG # If you don't want sendmail to replace the hostnames in all addresses # with the corresponding primary names, then comment out this line: R$*<@$+>$* $:$1<@$[$2$]>$3 use primary hostname R$+<@$+.uucp> $2!$1 u@h.uucp => h!u R$+ $:$>9$1 Clean up addr R$*<$+>$* $1$2$3 defocus ### Clean up a name for passing to a mailer (but leave it focused) S9 R$w!@ $@$w!$n R@ $@$n handle <> error addr R<@$+>$*:$+:$+ <@$1>$2,$3:$4 canonical ########################################## ### Local and program mailer specification # CONFIG # For SunOS 4.x or NeXTSTEP 3.x (or probably any BSD-ish system) use: #Mlocal, P=/bin/mail, F=rlsDFMmnP, S=10, R=20, A=mail -d $u # For SunOS 5.x (or probably any SysV-ish system) use: Mlocal, P=/bin/mail, F=flsSDFMmnP, S=10, R=20, A=mail -d $u Mprog, P=/bin/sh, F=lsDFMeuP, S=10, R=20, A=sh -c $u S10 # None needed. S20 # None needed. ############################## ### Ether mailer specification Mether, P=[TCP], F=msDFMuCX, S=11, R=21, A=TCP $h S11 # None needed. S21 # None needed. ############################# ### UUCP mailer specification Muucp, P=/usr/bin/uux, F=msDFMhuU, S=12, R=22, A=uux - -r -a$f $h!rmail ($u) # Convert uucp sender (From) field S12 R$+ $:$>5$1 convert to old style # Convert uucp recipient (To, Cc) fields S22 R$+ $:$>5$1 convert to old style ### General code to convert back to old style UUCP names S5 R$+<@$+.uucp> $@$2!$1 u@h.uucp => h!u R$+<@$*> $@$2!$1 u@h => h!u # Route-addrs do not work here. Punt til uucp-mail comes up with something. R<@$+>$* $@@$1$2 just defocus and punt R$*<$*>$* $@$1$2$3 defocus strange stuff ################# ### Ruleset 0 ### ################# # This is the ruleset that determines which mailer a name goes to. # Ruleset 30 just calls ruleset 3 then 0. S30 R$* $:$>3$1 first canonicalize R$* $@$>0$1 then rerun ruleset 0 S0 # On entry, the address has been canonicalized and focused by ruleset 3. # Handle special case..... R@ $#local $:$n handle <> form # Check for our names R$* $:$>40$1 accepted names -> us # Mail addressed to us R$*<@$J> $@$>30$1 strip our name, retry R<@$J>:$+ $@$>30$1 retry after route strip # Clean up addresses for external use R$* $:$>9$1 route-addr , -> : # For numeric spec, you can't pass spec on to receiver, since old receivers # are not smart enough to know that [x.y.z.a] is their own name. R<@[$+]>:$* $#ether $@[$1] $:$2 numeric internet spec R<@[$+]>,$* $#ether $@[$1] $:$2 numeric internet spec R$*<@[$+]> $#ether $@[$2] $:$1 numeric internet spec # Resolve UUCP-style names # CONFIG # If uux doesn't work, comment out these two lines, and uucp mail will # be passed up to the forwarder. #R<@$-.uucp>:$+ $#uucp $@$1 $:$2 @host.uucp:... #R$+<@$-.uucp> $#uucp $@$2 $:$1 user@host.uucp # Pass non-Internet mail up to the forwarder R$*<@$*.$=U>$* $#$M $@$R $:$1<@$2.$3>$4 user@pseudo.domain # Assume other address are Internet addresses, and deliver R$*<@$+>$* $#ether $@$2 $:$1<@$2>$3 user@internet.domain # other names have nowhere to go; return them to sender. R$*@$* $#error $:I don't understand $1@$2 # Local names with % are really not local R$+%$+ $@$>30$1@$2 turn % => @, retry # everything else is a local name R$+ $#local $:$1 local names