· 9 years ago · Sep 19, 2017, 02:52 AM
1SELECT address FROM alias WHERE address = '%s' AND goto LIKE '%<login>%'
2
3%s This is replaced by the input key. SQL quoting is used
4 to make sure that the input key does not add unexpected
5 metacharacters.
6
7 %u When the input key is an address of the form user@domain,
8 %u is replaced by the SQL quoted local part of the
9 address. Otherwise, %u is replaced by the entire search
10 string. If the localpart is empty, the query is sup-
11 pressed and returns no results.
12
13 %d When the input key is an address of the form user@domain,
14 %d is replaced by the SQL quoted domain part of the
15 address. Otherwise, the query is suppressed and returns
16 no results.
17
18 %[SUD] The upper-case equivalents of the above expansions behave
19 in the query parameter identically to their lower-case
20 counter-parts. With the result_format parameter (see
21 below), they expand the input key rather than the result
22 value.
23
24 %[1-9] The patterns %1, %2, ... %9 are replaced by the corre-
25 sponding most significant component of the input key's
26 domain. If the input key is user@mail.example.com, then
27 %1 is com, %2 is example and %3 is mail. If the input key
28 is unqualified or does not have enough domain components
29 to satisfy all the specified patterns, the query is sup-
30 pressed and returns no results.
31
32smtpd_sender_login_maps = mysql:/etc/postfix/mysql-virtual-sender-maps.cf
33smtpd_sender_restrictions = reject_authenticated_sender_login_mismatch permit_sasl_authenticated
34
35user = mailuser
36password = xxxxxxxxxxxxxxxx
37hosts = 127.0.0.1
38dbname = postfixadmin
39query = SELECT address FROM alias WHERE goto LIKE '%%%s%%'
40
41CREATE TABLE IF NOT EXISTS `alias` (
42`address` varchar(255) NOT NULL,
43`goto` text NOT NULL,
44`domain` varchar(255) NOT NULL,
45`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
46`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
47`active` tinyint(1) NOT NULL DEFAULT '1'
48) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Postfix Admin - Virtual Aliases';
49
50CREATE TABLE IF NOT EXISTS `mailbox` (
51`username` varchar(255) NOT NULL,
52`password` varchar(255) NOT NULL,
53`name` varchar(255) CHARACTER SET utf8 NOT NULL,
54`maildir` varchar(255) NOT NULL,
55`quota` bigint(20) NOT NULL DEFAULT '0',
56`local_part` varchar(255) NOT NULL,
57`domain` varchar(255) NOT NULL,
58`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
59`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
60`active` tinyint(1) NOT NULL DEFAULT '1'
61) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Postfix Admin - Virtual Mailboxes';
62
63query = SELECT goto FROM alias WHERE address = '%s'
64
65smtps inet n - y - - smtpd
66 -o syslog_name=postfix/smtps
67 -o smtpd_tls_wrappermode=yes
68 -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject_unauth_destination
69 -o smtpd_sender_restrictions=reject_authenticated_sender_login_mismatch
70 -o smtpd_sender_login_maps=mysql:/etc/postfix/mysql-smtpd-sender-login-maps.cf,mysql:/etc/postfix/mysql-virtual-sender-maps.cf
71
72user = mailuser
73password = xxxxxxxxxxxxxxxx
74hosts = 127.0.0.1
75dbname = postfixadmin
76query = SELECT goto FROM alias WHERE address='%s'
77
78user = mailuser
79password = xxxxxxxxxxxxxxxx
80hosts = 127.0.0.1
81dbname = postfixadmin
82query = select username from mailbox where username='%s'