How to bouce mail for users with no forwarding address

This is a post I made to comp.mail.sendmail:

One way to do this is to modify the redirect feature. This is something I talk about in my "Managing Internet Mail" class as an example of changing an existing feature and including it as a HACK().

This basic idea is to change the redirect feature so that rather than returning a new email address, instead it simply says the user is no longer here.

It is really quite simple. Copy the redirect feature to be gone.m4 in the cf/hack directory and then change it slightly replacing REDIRECT with GONE and change the error message:

      VERSIONID(cf/hack/gone.m4     Robert Harker        20050930)


      # addresses sent to foo@host.REDIRECT will give a 551 error code
      R$* < @ $+ .GONE. >            $:$1 < @ $2 . GONE . > < ${opMode} >
      R$* < @ $+ .GONE. > <i>        $:$1 < @ $2 . GONE. >
      R$* < @ $+ .GONE. > < $- >     $#error $@ 5.1.1 $: "551 User no longer here; no forwarding address"

You would add this to your file as a HACK():




Once you rebuild the file, you can then add aliases of the form:

      localuserID:      user@my.domain.GONE

where the localuserID is the user part of the address that is no longer valid and the user@my.domain can be anything as long as it has an @ sign in it as the address pointed to is not actually used.

When some one sends mail to localuserID@my.domain it is rejected with:

      551 User no longer here; no forwarding address

If you use the above rules rather than copying the redirect feature file to the hack directory, remember that the two fields of the rule *must* be separated by one or more tabs. Do not just pick and stuff with the mouse without changing the spaces back into tabs.

Just another "Harker’s Helpful Hints"