This document is
(C)opyright 1999 by Wouter Hanegraaff.
He doesn't maintain it anymore, but gave us the permission to
reproduce it here.
A translation into
russian is available from Marek 'Marx' Grac.
/usr/lib/sendmail-cf/cf/yourhost.m4
file
(The exact location of the cf directory may differ from your configuration)
to something like the following:
divert(0) VERSIONID(`@(#)sendmail.mc 8.8.7 ') OSTYPE(yourOs)dnl FEATURE(masquerade_envelope)dnl FEATURE(genericstable) GENERICS_DOMAIN(myhost) GENERICS_DOMAIN(myhost.mysubdomain.mydomain.dom) GENERICS_DOMAIN(mysubdomain.mydomain.dom) dnl # Defer Delivery to "expensive" mailers until next time the dnl # queue is processed using "O HoldExpensive=True" and make dnl # sure smtp mailers are "expensive". dnl # (See original "sendmail" book Chapter 30: Options, dnl # "Oc - Don't connect to expensive mailers", or dnl # 2nd Edition "sendmail" book Chapter 34.8.29, dnl # "HoldExpensive (c), Queue for expensive mailers".) dnl # / Leif ErlingssonThedefine(`confCON_EXPENSIVE', `True') define(SMTP_MAILER_FLAGS, e) define(`confTO_QUEUEWARN', `16h') define(`SMART_HOST', `mysmtp') MAILER(local)dnl MAILER(smtp)dnl
masquerade_envelope
feature tells sendmail to rewrite not
only the headers
but also the envelopes. Mailservers on the internet will look at the envelope,
and if it contains erroneous addresses, it will bounce the message.genericstable
feature causes sendmail to rewrite the
from address as defined in the
/etc/mail/genericstable
file. The GENERICS_DOMAIN
lines
define for which hosts/domains sendmail should rewrite the message headers and
envelopes using the genericstable.
define(`confTO_QUEUEWARN', `16h')
line will tell sendmail not to complain if it isn't able to send a mail
for less than 16 hours. This is useful if you have your computer automaticly
check and receive e-mail once or twice a day. Normally sendmail starts
complaining after 4 hours, which is too soon for me.smarthost
line configures sendmail to use the smtp server of
our internet
provider. This is not necessairy, but it can speed up sending mail because
sendmail will now transfer mail to yous isp's smtp which is usually fast.m4 ../m4/cf.m4 yourhost.m4 > yourhost.cfMake a backup of your /etc/sendmail.cf and copy yourhost.cf to
/etc/sendmail.cf
.
/etc/mail/genericstable
.
My genericstable file looks like this:
wouter@duckman.sloterdijk.nl hanegraa@wins.uva.nl wouter@duckman hanegraa@wins.uva.nl wouter hanegraa@wins.uva.nlMaybe the first line suffices, but the last lines won't hurt.
makemap hash /etc/mail/genericstable < /etc/mail/genericstableAfter restarting sendmail, things should work now.
14 wouter@duckman ~/docs 15:14 > sendmail -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <address>
> 3,1,10,4 wouter@duckman.sloterdijk.nl
rewrite: ruleset 3 input: wouter @ duckman . sloterdijk . nl
rewrite: ruleset 96 input: wouter < @ duckman . sloterdijk . nl >
rewrite: ruleset 96 returns: wouter < @ duckman . sloterdijk . nl . >
rewrite: ruleset 3 returns: wouter < @ duckman . sloterdijk . nl . >
rewrite: ruleset 1 input: wouter < @ duckman . sloterdijk . nl . >
rewrite: ruleset 1 returns: wouter < @ duckman . sloterdijk . nl . >
rewrite: ruleset 10 input: wouter < @ duckman . sloterdijk . nl . >
rewrite: ruleset 50 input: wouter < @ duckman . sloterdijk . nl . >
rewrite: ruleset 50 returns: wouter < @ duckman . sloterdijk . nl . >
rewrite: ruleset 94 input: wouter < @ duckman . sloterdijk . nl . >
rewrite: ruleset 93 input: wouter < @ duckman . sloterdijk . nl . >
rewrite: ruleset 3 input: hanegraa @ wins . uva . nl
rewrite: ruleset 96 input: hanegraa < @ wins . uva . nl >
wins.uva.nl: Name server timeout
rewrite: ruleset 96 returns: hanegraa < @ wins . uva . nl >
rewrite: ruleset 3 returns: hanegraa < @ wins . uva . nl >
rewrite: ruleset 93 returns: hanegraa < @ wins . uva . nl >
rewrite: ruleset 94 returns: hanegraa < @ wins . uva . nl >
rewrite: ruleset 10 returns: hanegraa < @ wins . uva . nl >
== Ruleset 10,4 (10) status 75
rewrite: ruleset 4 input: hanegraa < @ wins . uva . nl >
rewrite: ruleset 4 returns: hanegraa @ wins . uva . nl
>
If this works, we're all set!
Outgoing mail will be queued but not delivered (there's usually no internet
connection so this is a good thing). So, after connecting to the internet
we have to make sure mail is sent using the command
sendmail -q