$sudo apt-get install sendmail
Wait and let machine do rest of the stuffs.
Configure sendmail to route mail to specific hosts:
This can be accomplished by adding appropriate entries to the /etc/mail/mailertable file.
This file allows you to specify a domain, and where you want all email for that domain sent to.
In the example below, all email destined for mydomain.com will be automatically forwarded to a mail server that resolves to backend.mail.server. Additionally, all email received from the 192.0.0.0 network will be forwarded to a mail server that resolves to outbound.mail.server.
mydomain.com smtp:backend.mail.server192. smtp:outgoing.mail.server
After your modifications to /etc/mail/mailertable are complete you will need to run the following command:
#makemap hash /etc/mail/mailertable.db < /etc/mail/mailertable Restart sendmail: #service sendmail restart
Thats it. Now sendmail is ready to route your mail to specific hosts preventing other machines to receive the same.