Recipe 3.2 Passing Outbound Mail to a Relay

Problem

You have been asked to configure sendmail to send all mail bound for external systems through a mail relay host.

Solution

Create a sendmail configuration that uses the SMART_HOST define to identify the mail relay host:

 dnl Define a relay for all outbound mail define(`SMART_HOST', `smtp.wrotethebook.com') 

Build the new sendmail.cf file, copy it to the correct path , and restart sendmail, as described in Recipe 1.8.

Discussion

The SMART_HOST define sets a value for the sendmail.cf $S macro. The $S macro identifies the smart host . sendmail uses the smart host to relay mail to external systems. A few -bv tests show the impact of the SMART_HOST define:

 #  sendmail -bv sara@crab  sara@crab... deliverable: mailer relay, host smtp.wrotethebook.com, user sara@crab. wrotethebook.com #  sendmail -bv tyler@example.com  tyler@example.com... deliverable: mailer relay, host smtp.wrotethebook.com, user  tyler@example.com #  sendmail -bv craig  craig... deliverable: mailer local, user craig 

The first two tests show that all mail addressed to an external host, whether the host is part of the local wrotethebook.com domain or part of some other domain, is sent to the smart host for delivery to the external host. The third test shows that all mail that can be delivered by the local mailer is kept on the local system and delivered by the local mailer.

This configuration differs from the nullclient configuration in two ways:

  1. Local mail remains on the local host.

  2. Mail that originates from the local host has the local host's hostname in the sender address.

This creates a sendmail configuration that can handle its own local mail but must depend on a mail relay host for access to external systems. The concept of a smart host originally developed because many organizations had limited Internet connectivity. In those days, mail was relayed through the smart host because the smart host was the only host that could deliver the mail. These conditions still exist in some locations, but a more common reason that this configuration is popular is because network managers want to route all outbound mail through a single server for increased security, simplified queue management, and centralized logging.

See Also

Section 4.3.3.6 in the sendmail book discusses the SMART_HOST define.



Sendmail Cookbook
sendmail Cookbook
ISBN: 0596004710
EAN: 2147483647
Year: 2005
Pages: 178
Authors: Craig Hunt

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net