Jørn Skjerven a écrit : > Hi everybody! > > I'm trying to implement a blocklist based on a MySQL lookuptable. It > works for returning single values like REJECT or OK, but I want it to > return 4XX "some text" the same way as can be done using a standard > accessmap. The problem is to return the TEXT. > > I have tried the following query: > > query = SELECT action,text FROM blocked_accounts WHERE address = '%s'
you're trying to return two columns when postfix lookups want one. either rebuild your tables to mix the action and text (in your example, I don't see why you would have two fields...) or compose the fields into a single one. whatever you chose, a VIEW is probably a good idea. > > which returns: > > postmap -q "account" > mysql:/usr/local/etc/postfix/mysql_virtual_block_domains.cf > <http://mysql_virtual_block_domains.cf> > 452,The account is over quota, please try to resend the email later > no, that's not what "it returns". that's what your shell mysql command prints on your terminal. but your mysql query returns two columns. postfix maps want a single result. a trivial fix would be to use CONCAT(). > This is set up in smtpd_recipient_restrictions as > > check_recipient_access > mysql:/usr/local/etc/postfix/mysql_virtual_block_domains.cf > <http://mysql_virtual_block_domains.cf> > > This does not work and logs the following: > Feb 24 09:11:29 mx2 postfix/smtpd[50672]: NOQUEUE: reject: RCPT from > srv106.webdeal.no <http://srv106.webdeal.no>[195.28.173.100]: 451 4.3.5 > Server configuration error; from=<sender> to=<account> proto=SMTP > helo=<srv106.webdeal.no <http://srv106.webdeal.no>> > > Is there any way to make this work, woraround or alterative setup that > can be used ? > > > -- > Jørn Skjerven > WebDeal AS