Marshal Newrock wrote on 10-12-2006 9:20:
On Sat, 09 Dec 2006 20:11:19 +0100 Nils Vogels nivo@is-root.com wrote:
Now, I am pretty sure the problem lies with the %u, expanding to user+test@mydomain, which in some way should become user@mydomain, since the latter is the actual mailbox name of the user, but: how?
Check the postfix setting recipient_delimiter.
vm-mail# postconf recipient_delimiter recipient_delimiter = + vm-mail# postfix reload postfix/postfix-script: refreshing the Postfix mail system vm-mail# echo "Test8" | mail user+test@mydomain .. results in a bounce, since user+test@mydomain is not a valid mailbox name, user@mydomain is.
Is there any macro (such as %u) that expands to *JUST* the local user part of an e-mail address ?
In my system, there is a file called variables.txt in /usr/share/doc/dovecot. %n should just be the user part, as %d is the domain part, so "%n@%d" would still be the full email address. If %n would still be "user+test" (I don't know if this is the case) then perhaps there should be an additional modifier which strips out everything between a certain character and @. Meanwhile, it's possible to simulate this in the query. In MySQL, the query would be something like "WHERE email=CONCAT(SUBSTRING_INDEX('%u', '+', 1), '@', '%d')"
%n is 'user+test; in my testcase, and not 'user' as I would like it to be. Would it be possible to add a variable to dovecot that only gives me the local user part, because indeed that should solve the problem.
Probably, also a configuration item needs to be added, to make deliver aware of the character that was chosen as recipient delimiter, since the '+' maybe standard for postfix, but other choices could be made as well.
On a side note: the SQL query from Marshal only works if there is a recipient delimiter present, if it is not, it adds the domain name to the e-mail address being looked up, causing all kinds of other problems. I haven't found a SQL query to mimic the desired deliver behaviour in this case yet.
Greetings,
Nils
-- Those who desire to give up freedom in order to gain security, will not have, nor do they deserve, either one.
~Benjamin Franklin (American Statesman, Scientist, Philosopher, Printer, Writer and Inventor. 1706-1790)