On Sat, 13 Jan 2007 20:57:05 +0100
Joe Knall <[EMAIL PROTECTED]> wrote:
> As far as I understand a mail with two recipients triggers hook_rcpt
> twice. Problem: hook_rcpt returns only one return value.
Yes, one for each recipient.
> Imagine a mail like this:
> echo test | mail -r [EMAIL PROTECTED] -s test37 \
> [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]
>
> Now [EMAIL PROTECTED] doesn't exist so my check (hook_rcpt)
> actually should return DENY, but recipient1 and recipient3 do exist so
> my check actually should return OK.
Err... you get just one recipient for reach time hook_rcpt() is called.
Deny or accept this single recipient and all is fine.
> In fact if hook_rcpt returns DENY for my non existent recipient2 the
> other two won't get their messages.
No, each RCPT TO gets it's own answer. So rcpt1 and rcpt3 are accepted,
rcpt2 not. If none of these 3 gets a mail, it's the sender's fault.
> Currently I save the returns, evaluate them afterwards (hook_data) and
> return OK as soon as at least one of them is OK.
> Does anyone know an easy way how to hanldle this case, eg. how to send a
> reply "[EMAIL PROTECTED] doesn't exist"?
Just return DENY for this one and OK/DECLINED for the existing
recipients.
> Related case:
> Header lines can be accessed in hook_data_post which is only run once.
> How can I add different headers for each recipient like
> "X-Test-Redirected: for [EMAIL PROTECTED] to
> [EMAIL PROTECTED]"? Of course this should not be
> written to the headers of recipient3.
You can't... at least not in this hook ;-> You can try to queue a mail
for each recipient... But this really should be handled by the backend,
not in the SMTPD.
> I think qpsmtpd does nothing wrong, it just handles mail. So in the end
> my question boils down to "how do I make qpsmtpd handle a mail with
> multiple recipients as several completely separate transactions?"
As long it's just the above, you don't need it.
Hanno