The canonify Rule Set 3

The canonify rule set 3 is the first to process every address. Beginning with V8.10 sendmail, that rule set is declared like this:


The name canonify gives a clue to its role, that of putting all addresses into focused or canonical form.

The canonify rule set 3 puts each address it gets into a form that simplifies the tasks of other rule sets. The most common method is to have the canonify rule set 3 focus an address (place angle brackets around the host part). Then later rules don’t have to search for the host part because it is already highlighted. For example, consider trying to spot the recipient host in this mess:


Here, user is eventually intended to receive the mail message on the host uuhost. But where should sendmail send the message first? As it happens, sendmail selects uuhost (unless it is uuhost). Focusing on this address therefore results in the following:


Note that uuhost was moved to the end, the ! was changed to an @, and .uucp was appended. The @ is there so that all focused parts uniformly contain an @ just before the targeted host. Later, when we take up post-processing, we’ll show how final rule set 4 moves the uuhost back to the beginning and restores the !.

In actual practice, the role of the canonify rule set 3 is much more complex than this example. In addition to focusing, it must handle list-syntax addresses (ColonOkInAddr), missing and malformed addresses, the % hack ...

Get Sendmail, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.