On Wed, Dec 15, 2010 at 10:51:13AM -0500, Wietse Venema wrote: > Spacelee: > > hi everything, I met a problem recently because we need to add a new > > function to our product. > > the problem is for each valid incoming email, we need to call a script to > > insert it to different databases, someone said I could add this to the > > /etc/aliases, like : b...@example.org: "|/tmp/somescripts.sh", but it's only > > used for special users, unable for all the users(or emails) > > > > what should I do? do you have any suggestions? > > I concur with the suggestions to use a database engine that supports > the LMTP protocol, such as DBmail. With a proper protocol such as > LMTP, there is no need for the overhead of running a command-level > tool for each individual email delivery. LMTP is also much better > at handling delivery errors.
This said, if the OP is not really interested in DB mail, but rather has a few aliases that require programmatic processing of incoming mail, the best approach is to use /etc/aliases, and if desired use "localhost.$mydomain" as the only domain in $mydestination, and use virtual(5) aliases to map appropriate incoming mail into this domain. main.cf: indexed = ${default_database_type}:${config_directory}/ # Postfix versions <= 2.6 empty = regexp:/dev/null # Postfix 2.7 or later, if Wietse does not object to this idiom # empty = internal:empty mydestination = localhost.$mydomain virtual_alias_maps = ${indexed}virtual # Accept local mail only for explicitly aliased addresses # Allow only virtual(5) aliased local users local_recipient_maps = $empty virtual: special-u...@example.com special-u...@localhost -- Viktor.