Add to a Class with .C

The .C rule-testing command is used to add a member to a class. If the class does not exist, it is created. One possible use for this command would be to test whether adding a member to $=w will have the effect you desire. For example, suppose that a new alias called mailhub has been created for the local host. In the following, we test sendmail to see whether it will detect that new name as local:

% /usr/sbin/sendmail -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> canonify,parse bob@mailhub
canonify           input: bob @ mailhub
Canonify2          input: bob < @ mailhub >
Canonify2        returns: bob < @ mailhub >
canonify         returns: bob < @ mailhub >
parse              input: bob < @ mailhub >
Parse0             input: bob < @ mailhub >
Parse0           returns: bob < @ mailhub >
ParseLocal         input: bob < @ mailhub >
ParseLocal       returns: bob < @ mailhub >
Parse1             input: bob < @ mailhub >
MailerToTriple     input: < > bob < @ mailhub >
MailerToTriple   returns: bob < @ mailhub >
Parse1           returns: $# esmtp $@ mailhub $: bob < @ mailhub >
parse            returns: $# esmtp $@ mailhub $: bob < @ mailhub >

This form of rule testing and the output that is produced are described in detail in Process-Specified Addresses on page 314. Here, merely note that the esmtp delivery agent was selected, suggesting that mailhub was not automatically recognized as local.

One way to fix this is to add mailhub to the class $=w ($=w on page 876). In rule-testing mode this can be done by using the .C command:

> .Cw mailhub ...

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.