On Sun, Nov 14, 1999 at 01:08:20AM +0100, Florent Guillaume wrote:
> With all the recent discussion about aggregating RCPTs for the same MX,
> I took a look at qmail's code.
>
> It became clear quite fast that general aggregation was quite impossible
> given the architecture.
Note that this is due to the architecture of both qmail and SMTP. One
of the problems with aggregation when using qmail is VERPs which change
the envelope sender based on the destination address. This requires
that each recipient be delivered seperately when using SMTP, and I am
aware of no protocol that can deal with this adequately, never mind a
MTA that can handle it.
> Now, how I do it : basically, at the right spot, I aggregate recipients
> by domain name (this part is not finished) and I collapse them into a
> single recipient, for instance I collapse [EMAIL PROTECTED] and
> [EMAIL PROTECTED] into [EMAIL PROTECTED]\[EMAIL PROTECTED] where \1 is
> the character '\1' in C. This I do only for remote dispatches. Then in
> qmail-rspawn, I split things back up. This part is written but has not
> be tested (at all), there may be some faults in my code (for instance
> offset-by-one bugs). Note that qmail-rspawn is also a long-standing
> daemon so we've got to be pretty carefull about memory allocation, I
> special-cased the case where we had less than 10 recipients to use
> non-malloced memory, but this is probably misguided.
>
> Yeah, I know, collapsing with \1 is dirty, uggly, not clean, etc. But it
> should work.
I'm not aware of how qmail handles things internally, but the on-disk
structure prefixes each recipient address with 'T' and suffixes them
with '\0'. Perhaps an idea might be to prefix all but the final
recipient in a group with 't' or suffix the last recipient with '\0\0'.
This double NUL could potentially be used internally but would be
somewhat more complex to parse -- it would cause modification to much
more qmail code.
If you determine that you need to use '\1', I would suggest you escape
it -- '\1\1' translates to a literal '\1', while '\1\2' translates to
your separator. Messier to code, but cleaner in the end since you don't
have to refuse any messages based on the use of this character in a
recipient address.
--
Bruce Guenter <[EMAIL PROTECTED]> http://em.ca/~bruceg/