ConnectOnlyTo
Connect only to one specified host V8.10 and later
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... on
page 126) 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access