On 2014-03-16 21:52, bluethu...@jokefire.com wrote:
On 2014-03-16 21:32, Viktor Dukhovni wrote:
On Mon, Mar 17, 2014 at 02:28:02AM +0100, Sergei wrote:

On Sunday 16 March 2014 21:19:24 bluethu...@jokefire.com wrote:
> user=mail
> password=secret
> dbname=maildb
> table=domains
> select_field=domain
> where_field=domain
> hosts=127.0.0.1
> additional_conditions = and enabled = 10

I am not familiar with this syntax. I use the following:

user = mail
password = secret
hosts = 127.0.0.1
dbname = maildb
query = SELECT * FROM domains WHERE domain='%s'

Better:

query = SELECT domain FROM domains WHERE domain='%s' AND enabled = 10

there is no need to select all the columns.  (No idea what the
significance of "enabled = 10" is, except that seemingly this is
what the OP wants or perhaps it is the reason why no results are
returned).


Thanks guys! This did the trick! However it looks like I have a type-o
causing the problems. Instead of 'enabled = 10' should be 'enabled =
1'. LOL

user = mail
password = secret
hosts = 127.0.0.1
dbname = maildb
query = SELECT * FROM domains WHERE domain='%s' AND enabled = 1

Using the above query works fine with postfix:

[root@mail:/etc/postfix] #postmap -q example.com
mysql:/etc/postfix/mysql_domains.cf
3,example.com,virtual:,1

Once again, thank you ALL for your suggestions. Glad we got this one solved.



Actually I should probably point out that the original syntax does work better:

[root@mail:/etc/postfix] #cat mysql_domains.cf
user=mail
password=secret
dbname=maildb
table=domains
select_field=domain
where_field=domain
hosts=127.0.0.1
additional_conditions = and enabled = 1


[root@mail:/etc/postfix] #postmap -q example.com mysql:/etc/postfix/mysql_domains.cf
example.com

As opposed to the following output:

[root@mail:/etc/postfix] #postmap -q example.com
mysql:/etc/postfix/mysql_domains.cf
3,example.com,virtual:,1

Using this syntax:

user = mail
password = secret
hosts = 127.0.0.1
dbname = maildb
query = SELECT * FROM domains WHERE domain='%s' AND enabled = 1

Tim


Reply via email to