Recipe 2.10 Using Program Names in Mailing Lists

Problem

sendmail eliminates duplicates in mailing lists; however, you must ensure that all users listed in a mailing list receive their mail, even when multiple users receive their mail through a pipe to the same program.

Solution

If recipient addresses in the aliases file are not unique because they identify the same program, make them unique by inserting a harmless shell comment after the program's pathname.

Discussion

Duplicate recipients are deleted during mailing list processing to prevent delivery of multiple copies of the same piece of mail to the same user . This can cause problems when the duplicate recipients are really separate instantiations of the same program. The following aliases file illustrates this:

 sales:            frank, clark, amanda, jill, jeff owner-sales:      sales-request sales-request:    alana clark:            "/usr/bin/procmail" jeff:             "/usr/bin/procmail" jill:             "/usr/bin/procmail" 

In this case, mail to clark , jeff , and jill all appears to go to the same recipient ” /usr/bin/procmail . When duplicates are eliminated, only one of the three users gets a copy of the mail.

Most programs that are designed to work with sendmail are written to require a username as a command-line argument. It is not that the program necessarily needs this value, it is done to avoid duplicates when the program is used as a recipient in the aliases file. procmail , however, does not require the username as a command-line argument; in fact, it runs very nicely without any command-line arguments.

Make each recipient value unique by adding the username as a shell comment after the procmail command. The comment is ignored, so it has no impact on the execution of procmail , but it makes each recipient line unique, so there are no problems with duplicate recipients. Here is the corrected mailing list for the aliases file:

 sales:            frank, clark, amanda, jill, jeff owner-sales:      sales-request sales-request:    alana clark:            "/usr/bin/procmail #clark" jeff:             "/usr/bin/procmail #jeff" jill:             "/usr/bin/procmail #jill" 

Users do not need to add a username when they pipe to the procmail program from their .forward files. When multiple references to procmail come from a single file (e.g., the aliases file), sendmail needs help to resolve the duplication. sendmail does not need help resolving the duplication when the entries are retrieved from different .forward files.

See Also

Recipe 2.7 also discusses the elimination of duplicates in mailing lists.



Sendmail Cookbook
sendmail Cookbook
ISBN: 0596004710
EAN: 2147483647
Year: 2005
Pages: 178
Authors: Craig Hunt

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net