O'Reilly logo

Sendmail, 3rd Edition by Bryan Costales

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

ConnectOnlyTo

Synopsis

Sometimes it is necessary to test sendmail without allowing mail to be delivered or relayed offsite. In the ideal test situation, it is preferable that the recipient and sender addresses are not modified in the process. After all, one needs to be sure that all headers will be correct, and that all necessary rule sets will be exercised.

The ConnectOnlyTo option provides just such a service by allowing all mail to be relayed to a single machine, regardless of how the mail is addressed. It is declared like this:

O ConnectOnlyTo=ipaddr                     configuration file (V8.10 and later) 
-OConnectOnlyTo=ipaddr                     command line (V8.10 and later) 
define(`confCONNECT_ONLY_TO',`ipaddr') mc configuration (V8.10 and later) 

Here, ipaddr is the IP addresses of the target machine to which all mail will be delivered. It must be given in the form of a dotted quad unless sendmail was compiled with NETINET6 (NET...) defined, in which case you can specify an IPv6 address.

The ConnectOnlyTo option can be used when testing, and commented out otherwise. The ConnectOnlyTo option should not be confused with the nullclient or msp features, which send all mail to a hostname that can use MX records, and thus is more versatile and does a superior job of forwarding mail to a dedicated mail server.

An easy way to create a target for the ConnectOnlyTo option’s setting that accepts all SMTP mail, but logs and discards each inbound piece, is to add the following to a new and separate mc configuration ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required