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


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

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

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

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

4. makemap hash /etc/mail/mailertable < /etc/mail/mailertable 5. testing echo testing | /usr/sbin/sendmail -v above command should send email from to through mailrelay server. 6. that's it. Appendix: What to masquerade the sender email address to remove host info? change sender from to vi /etc/mail/ dnl EXPOSED_USER(`root')dnl

then run 'm4 >' 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.