I need to cover some quite special scenarios here in terms of identity selection, and therefore wanted first to understand the current logic how an identity is being selected (in order to implement a correct and working patch later on).
I got stuck already at first attempt. Say we have the following two messages with their headers (please don't ask why there are two headers "Envelope-To:", just please take it as a matter of fact):
Delivery-date: Sat, 06 Jul 2013 20:29:21 +0200 Return-path: theo1@tester.de Envelope-To: identity1@test.de Envelope-To: identity2@test.de MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 06 Jul 2013 20:29:21 +0200 From: theo1@tester.de To: theo2@tester.de Subject: Test #1 (Envelope-To: identity1@test.de, Envelope-To: identity2@test.de) Message-ID: identity1@tester.de X-Sender: theo1@tester.de User-Agent: Roundcube Webmail/1.0-git
Delivery-date: Sat, 06 Jul 2013 20:29:21 +0200 Return-path: theo1@tester.de Envelope-To: identity2@test.de Envelope-To: identity1@test.de MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 06 Jul 2013 20:29:21 +0200 From: theo1@tester.de To: theo2@tester.de Subject: Test #1 (Envelope-To: identity2@test.de, Envelope-To: identity1@test.de) Message-ID: identity2@tester.de X-Sender: theo1@tester.de User-Agent: Roundcube Webmail/1.0-git
Please also take it as a matter of fact that "identity1@test.de" and "identity2@test.de" are being defined as identities in Roundcube.
The main difference between these two messages is the order of the "Envelope-To:" headers. But apparently that doesn't make any difference at all, as when replying to these messages, the identity "identity1@test.de" is being used as the sender in the "From:" header in both cases. Hmm...?!?
This logic escapes me and makes my life more difficult, as this behaviour is telling me that the order (of both the same headers in the same message!) doesn't make any difference. Is the choice being taken because of the alphabetical order of the sender addresses (so that "identity1@test.de" is preceding "identity2@test.de")?
At this point I stopped testing, and my next question is:
As I'm able to create any custom header right before delivery, how can I make sure that this - and only this - custom header will be respected with regards to identity selection, disregarding any other headers/addresses and the entire rest of the logic...?
This would be a private patch, of course. Any help and hint appreciated, for I'm a noob in terms of PHP (= I have an idea of the logic, but just can't code it).
Michael Heydekamp Co-Admin freexp.de Düsseldorf/Germany