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.
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)
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.
ConnectOnlyTo option can be used when testing,
and commented out otherwise. The
option should not be confused with the
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 ...