Receiving and sending mail from the internet with sendmail

This the simplest setup to allow a solaris system connected to the internet to send and receive email and to rewrite the addresses as user@domainname

There are two parts to this, one is sendmail configuration and the second is DNS configuration.

Sendmail configuration

First of all we need to create a custom sendmail config file. it is not necessary to edit sendmail.cf files directly, its much easier to generate them from the m4 macro files.

The m4 files on solaris 9 can be found in /usr/lib/mail/cf

The standard server sendmail m4 file is called main.mc. If this is the first time you have edited it, copy it to a different filename so that you know that it is not the standard one, eg myconfig.mc


Edit the file myconfig.mc so that it looks like:


divert(-1)
#
#

divert(0)dnl
VERSIONID(`@(#)myconfig.mc	1.0 (MYCONFIG) 05/05/03')
OSTYPE(`solaris8')dnl
DOMAIN(`solaris-generic')dnl
MAILER(`local')dnl
MAILER(`smtp')dnl
MASQUERADE_AS(`mydomain.com')dnl
The MASQUERADE_AS line makes all email appear to come from the domain not from the hostname of the system. For more complicated masquerading including handling multiple domains see the page on using_genericstable.

Edit the Makefile to make the new config file as well as the standard main.cf and subsidiary.cf.

run make to make the new custom sendmail config file - this will be called myconfig.cf

copy the new config file to /etc/mail/sendmail.cf

edit /etc/mail/local-host-names to add the domains that you want to allow relaying for

mydomain.com
myotherdomain.com

then restart Sendmail. (# /etc/rc2.d/S88sendmail stop; /etc/rc2.d/S88sendmail start

DNS configuration

Add the required MX records to the DNS zone file(s) for your domain(s) similar to the examples below:
mydomain.com		IN	MX	10	mymailserver.mydomain.com
myotherdomain.com	IN	MX	10	mymailserver.mydomain.com


done ! - Your system should now accept and send email and rewrite outgoing addresses as user@domainname

If you want to use send email from a wintel client eg. outlook, you will need to setup the server to accept email relays from this client. The email relaying pages explain how to do this.