/etc/mail/relay-domains
contains a list of hosts which are allowed to relay mail through your mail server. This list may consist of either specific hosts or whole domains.
/etc/mail/sendmail.cw
(after Sendmail version 8.10, this file is local-host-names) contains a list of domains for which your mail server will accept mail. This list is usually the domains hosted by your machine.
NOTE: put a CR/LF at the end of the last domain. Otherwise, it won't work.
Of course, you have to set up your actual Sendmail server to use the mail relay.
If your Unix host has to use a mail relay to get out, the simplest method is to define the DS (smart relay) macro in sendmail.cf
. You should have a line with DS
. Change it in DSmailrelay.domain
where mailrelay.domain
is the FQDN of your mail relay as seen from your side. The stop/start Sendmail to let it reread the config file.
This mail relay must accept SMTP connection from your host and must accept relaying. To check if the mail relay is working try
telnet mailrelay.domain 25
.... answer from mail relay .....
helo <unix hostname>
mail from: root@<unix hostname>
rcpt to: <email test>@<something out>
data
mail test from UNIX
.
The mail server should answer something like: mail sent. If this work you can try it with a normal mail client like
mailx -s "subject" <email test>@<something out>
mail test from UNIX
.
To check if this has worked look at /var/adm/syslog/mail.log
and you should see a couple of lines stating the mail has been accepted locally and sent to the relay and accepted.
Good luck.