Re: Postfix frontend on existing MySQL DB (routing problems)

From: Simone Felici (no email)
Date: Thu Jun 28 2007 - 10:27:41 EDT

  • Next message: mouss: "Re: Postfix frontend on existing MySQL DB (routing problems)"

    Hi again!

    mouss ha scritto:

    > then you have a problem. run the query manually in mysql.

    I dunno if the option proxy:mysql:/... or only mysql:/... into main.cf made a defference.

    >
    > - SELECT CONCAT('smtp:', next) FROM smtproutes where domain=example.com'
    > and account='foo'
    >
    > - SELECT CONCAT('smtp:', next) FROM smtproutes where domain=example.com'
    > and account=''
    >
    > and show the results.
    >
    > more comments below.
    >
    >> [snip]
    >> Simple example:
    >>
    >> Mysql:
    >> |account|domain|next|
    >> |foo|example.com|smtpsrv1|
    >> |<empty>|secondexample.com|smtpserver2|
    >
    > when you say "<empty>", do you mean it is an empty string ('') or NULL?
    > avoid NULL as it causes surprises in queries (do the quries on mysql
    > manually, and you'll see). you can see this yourselfby running queties
    > at mysql prompt (or in sqlyog, mysql gui tools, phpmyadmin, ...).
    >>
    >> When I send to , it works.
    >> When I send to , not, because the "AND" clause
    >> returns no rows.
    >
    > probably because account is NULL. NULL != empty string.
    >

    <empty> it means "", not NULL.
    I've tried manually the queries. If I use "AND", receiving a mails for they are not routed. It search this:

    SELECT CONCAT('smtp:', next) FROM smtproutes where domain='secondexample.com' and account='bar';
    0 ROWS!

    Also no way. A mail for '' works, because:
    SELECT CONCAT('smtp:', next) FROM smtproutes where domain='example.com' and account='foo';
    RESULT: smtp:smtpsrv1.

    Using "OR", I obtain a lot of results. It doesn't work as well.
    I'm preatty sure, my problem is I need to create two queries, depends on the destination mail:

    for mail to :
    SELECT CONCAT('smtp:', next) FROM smtproutes where domain='example.com' and account='foo';
    RESULT: "smtp:smtpsrv1"

    for , after have confirmed 0ROWS from the first query:
    SELECT CONCAT('smtp:', next) FROM smtproutes where domain='secondexample.com';
    RESULT: "smtp:smtpserver2"

    I've read about using master.cf pointing to external scripts. Can you point me to some docs or write me a little example, if it could be the solution.

    Simon

    -- 
    Simone Felici                    E-Mail: 
    Divisione Tecnica                Tel:    0461 030 111
    Alpikom S.p.A.                   Fax:    0461 030 112
    v.Fersina, 23 - 38100 Trento     URL:    http://www.alpikom.it
    

  • Next message: mouss: "Re: Postfix frontend on existing MySQL DB (routing problems)"





    Hosted Email Solutions

    Invaluement Anti-Spam DNSBLs



    Powered By FreeBSD   Powered By FreeBSD