Recipe 9.4 Assigning Recipients to Specific Queues

Problem

To use queues optimized for the characteristics of the destination host, you must route mail bound for recipient addresses on those hosts to the optimized mail queues.

Solution

Create the directories for the queue groups and, if necessary, the physical devices the queue group directories will use. See Recipe 9.1 and Recipe 9.3 for details.

Add QGRP : records to the access database to specify the queue groups used for specific recipients. The key of each entry is the tag QGRP : followed by a full or partial recipient address. The return value of the entry is the name of the queue group that should be used for the specified recipient.

Create a sendmail configuration that defines the queue groups, enables the access database, and uses the queuegroup feature. Here are sample lines that might be added to the sendmail configuration:

 dnl Define a queue group QUEUE_GROUP(`slowq', `Path=/var/spool/mqueue/slowq, I=2h') dnl Define a queue group  QUEUE_GROUP(`fastq', `Path=/var/spool/mqueue/fastq.*, I=10m, R=10') dnl Enable the access database FEATURE(`access_db') dnl Enable the queue group feature FEATURE(`queuegroup') 

Build and install /etc/mail/sendmail.cf , then restart sendmail, as shown in Recipe 1.8.

Discussion

The access database provides the most flexible means to utilize queue groups. QGRP : records in the access database allow you to assign individual domains, and even individual users, to specific queue groups. This makes it possible to create queue groups that have characteristics that are compatible with the characteristics of a recipient site. For example, the queue for a site that has repeated, long-duration outages might have a large Interval value, or multiple queues might be dedicated to a few domains that constitute the bulk of your outbound traffic.

Here is a sample QGRP : entry:

 QGRP:example.com          slowq 

The QGRP : record tells sendmail to use the slowq queue group to queue mail for every user on all hosts in the example.com domain. The recipient address in a queue group entry can identify an individual user or a group of hosts. The possible recipient address formats are:

  • A full address in the format user @ host.domain . This format matches a specific user on a specific host. QGRP: craig @crab.wrotethebook.com is an example.

  • A hostname in the format host.domain ; e.g., QGRP:crab.wrotethebook.com . Any user on the specified host is matched.

  • A domain name to match every user on every host in the specified domain. For example, QGRP:wrotethebook.com would match every recipient in the wrotethebook.com domain.

  • A username written in the form user @ ; e.g., QGRP:craig@ . This format matches any recipient with the specified username on any host in any domain.

  • A blank field, which matches every possible recipient address.

Mail addressed to recipients not covered by a QGRP : entry is queued in the default queue.

See Also

Recipe 9.3 covers the QUEUE_GROUP macro. The access database is used extensively in recipes throughout this book, with particularly detailed coverage in Chapter 3 and Chapter 6. The sendmail book covers the QGRP : record in Section 11.4.4.



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