As mentioned earlier in the chapter, you can’t use local
aliases, .forward files, and
mailing-list programs with virtual domains delivered by the virtual
delivery agent. You’ve seen that you can easily set up aliases through
virtual_alias_maps parameter, but
you cannot deliver messages to a command. In this last section, we’ll
look at working around that issue by demonstrating how to deliver
virtual addresses to external programs. The first example sets up
delivery to an autoreply program, and the second to a mailing-list
Auto-responders are scripts or programs that process incoming messages and return a reply to the sender of the message without any human intervention. The autoreply program used in this example, inforeply.pl, is listed in Example 8-1. This program is meant to handle mail for a dedicated information email address. Users or customers can send a message to the address to request special information. Note that this simple example is inadequate as a general autoreply program, such as the Unix vacation command. It does not cache addresses it has already replied to, and it does not do full checking for addresses that should not receive automatic replies (see the sidebar). You might also like to enhance the program to return different types of information, based on the subject or a keyword in the body of the request messages.
#!/usr/bin/perl -w # # inforeply.pl - Automatic email reply. # # All ...