Sendmail and Home Networks

If you have a network and want everyone to have access to email then the most sensible thing is to have a mail server running sendmail and some sort of POP3 or IMAP daemon so other users can read mail on their own machines. To do this you need to get sendmail to masquerade as your Demon hostname and to allow relays from the other machines in your network. For the purpose of explanation we'll assume your hostname is sample.demon.co.uk and your local network has IP addresses 192.168.1.x and domain name local

Masquerading

For masquerading you need something like this for the machine that's going to act as the mailhub for your network


MASQUERADE_AS(`sample.demon.co.uk')
MASQUERADE_DOMAIN(`local')
FEATURE(`masquerade_entire_domain')
FEATURE(`masquerade_envelope')

added to your m4 file then rebuild sendmail.cf. You should now find that the address user@machine.local gets transformed into user@sample.demon.co.uk.

Allowing Relays from your local network

For the local users to send mail they need to be able to relay off your mailhub. You can achieve this with the following in the access database (for the sample m4 configuration this is /etc/mail/access):


192.168.1		RELAY

Don't forget to rebuild the database with makemap hash /etc/mail/access.db < /etc/mail/access and to restart sendmail to get the changes to take effect.

Sendmail configuration on other machines

The sample m4 configuration is only necessary on the mailhub that handles the whole network's email. For any other machines you can use a slimmed down configuration that simply forwards everything to the mailhub for processing. The following m4 does that (we are assuming the mailhub has hostname mail.local on the local network)


divert(-1) 
include(`../m4/cf.m4') 
OSTYPE(`linux') 
define(`confDEF_USER_ID',``8:12'') 
undefine(`ALIAS_FILE')
define(`MAIL_HUB', `mail.local')
define(`SMART_HOST', `mail.local')
define(`confFORWARD_PATH', `')
MASQUERADE_AS(`sample.demon.co.uk')
MASQUERADE_DOMAIN(`local')
FEATURE(`masquerade_entire_domain')
FEATURE(`masquerade_envelope')
MAILER(smtp)

Then proceed with building sendmail.cf and so on as in the other case.


Up - Home