Postfix setup with Dovecot, MySQL error when sending mail

0

So, following problem. I'm trying to setup a Mailserver loosely following this tutorial here: https://workaround.org/ispmail/wheezy/

The problem starts when I try to send my first testmail (inside the system), I get the following:

postfix/pickup[15883]: F34B965841CF: uid=1000 from=<webmaster>
postfix/cleanup[15907]: F34B965841CF: message-id=20160519164815.F34B965841CF@mysite.com>
postfix/qmgr[15884]: F34B965841CF: from=<webmaster@mysite.com>, size=398, nrcpt=1 (queue active)
dovecot: auth-worker(15911): Warning: mysql: Query failed, retrying: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@example.org.' at line 1
dovecot: auth-worker(15911): Error: sql(john@example.org): Password query failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@example.org.' at line 1
dovecot: lda: Error: user john@example.org: Auth USER lookup failed
dovecot: lda: Fatal: Internal error occurred. Refer to server log for more information.
postfix/pipe[15909]: F34B965841CF: to=<john@example.org>, relay=dovecot, delay=0.02, delays=0.01/0/0/0.02, dsn=4.3.0, status=deferred (temporary failure)

Thing is, earlier in the Tutorial, you're supposed to manually try if your sql queries work with

postmap -q example.org mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf

and so on. And for me, it does work. No problem at all.

My files look pretty much exactly like in the tutorial

mysql-virtual-mailbox-domains.cf

user = mailuser
password = <pw>
hosts = mailserver
query = SELECT 1 FROM virtual_domains WHERE name='%s'

mysql-virtual-alias-maps.cf

user = mailuser
password = <pw>
hosts = mailserver
query = SELECT destination FROM virtual_aliases WHERE source='%s'

and so on. Anyone ever encounter this before? Any solutions or ideas?

Chris

Posted 2016-05-19T17:16:35.730

Reputation: 3

Answers

0

What fails according to the log is the password_query issued by dovecot.

From the tutorial at https://workaround.org/ispmail/wheezy/setting-up-dovecot
the query pasted verbatim is:

password_query = SELECT email as user, password FROM virtual_users WHERE email=’%u’;

The quotes around %u are Unicode fancy quotes as opposed to normal ASCII quotes. That's wrong and it explains why the query fails if you have copy-pasted that query like I just did above. They must be replaced by normal single quotes as in:

password_query = SELECT email as user, password FROM virtual_users WHERE email='%u';

Typically, it's the fault of the publishing platform that the tutorial is using, using filters automatically replacing normal quotes by fancy quotes. This is completely wrong when publishing code. https://en.wikipedia.org/wiki/Quotation_mark has a paragraph on this practice.

Daniel Vérité

Posted 2016-05-19T17:16:35.730

Reputation: 1 225