Other often asked questions about sendmail

Last Update 1999-03-05

Content:

Which sendmail version do I run?

To find out which version of sendmail is installed on your system, you can try the following commands:

sendmail -d0.4 -bv root
should tell you its version and some basic settings.

telnet localhost 25
sendmail should greet you with its welcome message and tell you the version of its binary and config file. Enter QUIT to leave this mode.

I can't send mail to users whose accounts have upper case letters.

First: Don't use uppercase letters...: man 5 passwd on a SunOS 4 machine:
     username       is the user's login name.   This  field  con-
                    tains  no  uppercase characters, and must not
                    be more than eight characters in length.
If you really need it, set the flag 'u' in
Mlocal,..F=..u..
             ^
in sendmail.cf
u   Upper case should be preserved in user  names  for
    this mailer.

If you use procmail as local mailer, make sure you define NO_USER_TO_LOWERCASE_HACK (in config.h?).

cannot alias non-local names

If you get the error: name: cannot alias non-local names when running newaliases (or sendmail -bi), there are several possibilities to check:
  1. Does
    sendmail -bt
    > 3,0 name
    
    resolve to the local mailer?
  2. Make sure you have the flag F=A for Mlocal in your sendmail.cf. (This applies to sendmail 8.8 ).

Quota on mail spool?

This is not a sendmail problem, but one of the local delivery agent. Check your Mlocal line in your sendmail.cf. If you have procmail you're settled, it obeys quotas. So you can install quotas on your mailspool (check with your OS version, e.g., man quota), and everything should work. You can also tell procmail to deliver e-mail into the HOME directory of the user, so you have solved several problems at once.

config error: mail loops back to myself

You are still getting this message:
	553 relay.domain.net config error: mail loops back to myself
	554 <user@domain.net>... Local configuration error
and both hints didn't solve your problem?

So here is another hint what might be wrong: You use a

LOCAL_RULE_0
in your sendmail.mc (which is S98 in sendmail.cf)? This rule is evaluated before the local recognition of S0 happens. So if you use some rule here, which (by accident) also matches your local host but doesn't resolve to local, you have a problem. Try to debug that address and see where it fails (where it gets resolved to another mailer than local).

How to route all mail to a single user?

Sometimes you want to route all mail for a domain to a single user. You can do this by a rule like this:
R$+ < @ the.domain. >		$#local $: the-user			all to one user
This usually goes into ruleset 0.

How to route mail to unknown users to one account?

sendmail 8 has a feature to route all mail which ends up as local on the system but isn't a valid account (or alias), to another system (the so-called LUSER_RELAY), see cf/README (from 8.8). However, this feature is disrecommended, since it can break ``working'' addresses if you introduce new local users.

If you want to route all mail to unknown users to one account (instead of giving the standard error reply), you can put in your .mc file the following:

define(`LUSER_RELAY',`local:someuser@your.domain')
or in some cases:
define(`LUSER_RELAY',`local:someuser')
Another method which isn't recommended (and only works with sendmail 8.0): look in your sendmail.cf for these lines and remove the hash in front of them:
Kuser user -m -a<>
DLlocal:someuser@your.domain

R< > $+ 		$: < $L . > $( user $1 $)	look up user
R< $* > $+ <> $*	$: < > $2 $3			found; strip $L
R< $* . > $+		$: < $1 > $2			strip extra dot
Something similar can be accomplished for virtual domains.

How do I queue mail for another domain?

Situation: Your system mailserver.my.domain should act as a backup mailserver for mailserver.client.domain. The client wants to receive mail for the address user@client.domain. This requires:
  1. MX Records:
    client.domain.		IN MX 10 mailserver.client.domain.
    client.domain.		IN MX 20 mailserver.my.domain.
    mailserver.client.domain.		IN MX 10 mailserver.client.domain.
    mailserver.client.domain.		IN MX 20 mailserver.my.domain.
    
    The last two records are there "just in case".
    Make sure you use the real names of all systems. mailserver.my.domain must know its own name, otherwise you'll get the famous mail loops back to myself error.

    Instead of using MX records that point to mailserver.client.domain, you can use the FEATURE(mailertable) on mailserver.my.domain as explained in cf/README for routing e-mails.

  2. On your system: do nothing unless you have anti-relay rules installed (which you really should have!). In this case, add client.domain to the required files (8.8) (or for 8.9). Don't add client.domain or mailserver.client.domain to class w on your system!
  3. sendmail on your system will try to deliver mail during queue runs, however, the client may trigger delivery by using the ETRN command.

Class w contains all local addresses

sendmail 8.8 includes all local addresses into class w to avoid the well-known config error: mail loops back to myself . If this is not intended, there's an undocumented compile-time-option, -D_FFR_DONT_PROBE_INTERFACES_OPTION which enables the option O DontProbeInterfaces in your sendmail.cf . Set it to True to keep sendmail from adding all local addresses to class w.

Map types: makemape/sendmail: Type hash/dbm not supported in this version

sendmail supports several map types. The main types are:
hash/btree
requries the compile flag -DNEWDB. This is the new Berkeley DB package. If your system does not have this pre-installed, or the version installed is not version 2.0 or greater (e.g., is Berkeley DB 1.85 or 1.86), get the current version from http://www.sleepycat.com/.
dbm
requries the compile flag -DNDBM. This is the older NDBM implementation.
Make sure the map type you're trying to use is compiled into your version of sendmail and makemap.

How do I change the sender address depending on the recipient?

There are several ways how to do it. One idea is to select different mailers according to the recipient, and then change the rewrite rules for the sender for that mailer. Here's an example: Make a copy of one of the smtp mailers in cf/mailer: mymailer.m4
#####################################
###  MYSMTP Mailer specification  ###
#####################################

VERSIONID(`@(#)mysmtp.m4	0.1 (ca) 1998-09-26')

Mmysmtp,		P=[IPC], F=CONCAT(mDFMuX8, SMTP_MAILER_FLAGS), S=mysmtp, R=ifdef(`_ALL_MASQUERADE_', `21/31', `21'), E=\r\n, L=990,
		_OPTINS(`SMTP_MAILER_MAX', `M=', `, ')_OPTINS(`SMTP_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/SMTP,
		A=SMTP_MAILER_ARGS
and add something like this:
MAILER(mymailer)dnl
LOCAL_RULE_0
Rfriend<@some.domain.>$*	$#mysmtp $@ some.domain. $: friend<@some.domain.>$1	
LOCAL_RULESETS
#
#  sender rewriting for mysmtp
#
Smysmtp
R$+			$: $>51 $1			sender/recipient common
R$* :; <@>		$@				list:; special case
R$*			$: $>61 $1			qualify unqual'ed names
R$* < @ *LOCAL* > $*	$: $1 < @ Domain.For.Friend . > $2		use full name
(or whatever rewriting you need/want) to your .mc file (if you need this for more than one address, use a class for the match).
[(links)] [Hints] [Avoiding UBE] [cf/README] [New]
Copyright © Claus Aßmann Please send comments to: <ca@sendmail.org>