Make sendmail working in a non-DNS environment

Environment: Default installation of CentOS 5.3 x86_64 with DNS server configured.
Objective: Make the server be able to send out email to a centralized mail server


Steps:

1. default install of CentOS 5.3
2. change /etc/hosts to be like this:

[root@log1 mail]# more /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6

10.0.0.1 log1.domain.com log1
10.0.0.2 mailrelay

then add the following to /etc/mail/service.switch, not services.switch
hosts files

3. vi /etc/mail/mailertabale
anotherdomain.com relay:[mailrelay]

4. makemap hash /etc/mail/mailertable < /etc/mail/mailertable 5. testing echo testing | /usr/sbin/sendmail -v jephe.wu@anotherdomain.com above command should send email from root@log1.domain.com to jephe.wu@anotherdomain.com through mailrelay server. 6. that's it. Appendix: What to masquerade the sender email address to remove host info? change sender from root@log1.domain.com to root@domain.com vi /etc/mail/sendmail.mc dnl EXPOSED_USER(`root')dnl
MASQUERADE_AS(`domain.com')dnl
FEATURE(masquerade_envelope)dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl
MASQUERADE_DOMAIN(log1.domain.com)dnl

then run 'm4 sendmail.mc > sendmail.cf' under /etc/mail, then restart sendmail service.

note: if it complains about not being able to find files when running above m4 command, you have to install sendmail-cf rpm package.