Re: Mysql relay_recipient query question
- Kimmo Hedman wrote:
> Lainaus Duane Hill <d.hill@...>:???
>> On Tue, 27 Feb 2007, Kimmo Hedman wrote:
>>> Hi all,
>>> im building spamfilter front-end relays and wanna drop smtp
>>> messages in first place if email address is not valid. Mailservers
>>> are running vpopmail+mysql, but users and domains are in seperate
>>> Fields in mysql table like this:
>>> Field: pw_name | pw_domain
>>> user | domain.com
>>> is there a simple query to check that the user exists?, i try to
>>> dig but only find solution where email address is in 1 Field;
>>> query = select pw_domain from vpopmail where pw_domain = '%s'
>>> bash# postmap -q "domain.com" mysql:/etc/postfix/mysql-recipients.cf
>>> bash# domain.com,domain.com,domain.com
>> My previous response should not have had the semi-colon at the end of
>> the line. It should have read:
>> query = select concat(pw_name,'@',pw_domain) from table_name where
>> concat(pw_name,'@',pw_domain) = '%s'
>> Also, keep in mind. If you have a large userbase in MySQL, using concat
>> will take longer as it has to concatinate the two fields together with
>> the '@' before the comparison is completed.
> It worked, thx! , seems that postfix doesn't need that extra
> relay_recipient argument after address/domain (in flat file something
> like @... X was needed).
>as Magnus said, there is no need for concat. %u and %d can be used.
> MySQL has about 2500 users, but i'm sure time that concat takes, is
> nothing compared to all the spamassassin's DCC, Razor2, Pyzor,
> DNS&blacklist queries + clamav (takes 5-10 seconds/mail when running
> them all!).
>while we are talking about address validation, it is good idea to use
> That's why i wan't to check first that users are valid. Maybe
> greylisting is second stage after this, well these are not postfix
> related stuff..Running all from Debian etch packages if someone wonder.
reject_non_fqdn_sender and reject_non_fqdn_recipient before looking up