Created
July 17, 2011 19:20
-
-
Save cb1kenobi/1087957 to your computer and use it in GitHub Desktop.
A better /etc/postfix/mysql-virtual_mailboxes.cf with + in email address support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user = mail_admin | |
password = mail_admin_password | |
dbname = mail | |
query = SELECT CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') FROM users u JOIN (SELECT '%s' AS orig_email) x ON u.email = CASE WHEN LOCATE('+', x.orig_email) > 0 AND LOCATE('+', x.orig_email) < LOCATE('@', x.orig_email) THEN CONCAT(SUBSTRING_INDEX(x.orig_email, '+', 1), '@', SUBSTRING_INDEX(x.orig_email, '@', -1)) ELSE x.orig_email END | |
hosts = 127.0.0.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment